home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / createodbcdatetime.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  2.5 KB  |  63 lines

  1. <!--- This example shows how to use Createdate,
  2. Createdatetime, createODBCdate and createODBCDateTime --->
  3.  
  4. <HTML>
  5.  
  6. <HEAD>
  7. <TITLE>
  8. CreateODBCDateTime Example
  9. </TITLE>
  10. </HEAD>
  11.  
  12. <BODY bgcolor=silver>
  13.  
  14. <H3>CreateODBCDateTime Example</H3>
  15.  
  16. <CFIF IsDefined("form.year")>
  17. Your date value, presented using different CF date functions:
  18. <CFSET yourDate = #CreateDateTime("#form.year#","#form.month#","#form.day#", "#form.hour#","#form.minute#","#form.second#")#>
  19.  
  20. <CFOUTPUT>
  21. <UL>
  22.     <LI>Built with CreateDate: #CreateDate("#form.year#","#form.month#","#form.day#")#
  23.     <LI>Built with CreateDateTime: #DateFormat("#CreateDateTime("#form.year#","#form.month#","#form.day#", "#form.hour#","#form.minute#","#form.second#")#")#
  24.     <LI>Built with CreateODBCDate: #CreateODBCDate("#yourDate#")#
  25.     <LI>Built with CreateODBCDateTime: #CreateODBCDateTime("#yourDate#")#
  26. </UL>
  27.  
  28. <P>The same value can be formatted with dateFormat:
  29. <UL>
  30.     <LI>Built with CreateDate: #DateFormat("#CreateDate("#form.year#","#form.month#","#form.day#")#", "mmm-dd-yyyy")#
  31.     <LI>Built with CreateDateTime: #DateFormat("#CreateDateTime("#form.year#","#form.month#","#form.day#", "#form.hour#","#form.minute#","#form.second#")#")#
  32.     <LI>Built with CreateODBCDate: #DateFormat("#CreateODBCDate("#yourDate#")#", "mmmm d, yyyy")#
  33.     <LI>Built with CreateODBCDateTime: #DateFormat("#CreateODBCDateTime("#yourDate#")#", "d/m/yy")#
  34. </UL>
  35.  
  36.  
  37. </CFOUTPUT>
  38.  
  39. </CFIF>
  40.  
  41.  
  42. <CFFORM ACTION="createodbcdatetime.cfm" METHOD="POST">
  43. <P>Please enter the year, month and day in integer format for 
  44. the date value you would like to view:
  45. <PRE>
  46. Year    <CFINPUT TYPE="Text" NAME="year" VALUE="1998" VALIDATE="integer" REQUIRED="Yes">
  47. Month    <CFINPUT TYPE="Text" NAME="month" VALUE="6" RANGE="1,12" MESSAGE="Please enter a month (1-12)" VALIDATE="integer" REQUIRED="Yes">
  48. Day    <CFINPUT TYPE="Text" NAME="day" VALUE="8" RANGE="1,31" MESSAGE="Please enter a day of the month (1-31)" VALIDATE="integer" REQUIRED="Yes">
  49. Hour    <CFINPUT TYPE="Text" NAME="hour" VALUE="16" RANGE="0,23" MESSAGE="You must enter an hour (0-23)" VALIDATE="integer" REQUIRED="Yes">
  50. Minute    <CFINPUT TYPE="Text" NAME="minute" VALUE="12" RANGE="0,59" MESSAGE="You must enter a minute value (0-59)" VALIDATE="integer" REQUIRED="Yes">
  51. Second    <CFINPUT TYPE="Text" NAME="second" VALUE="0" RANGE="0,59" MESSAGE="You must enter a value for seconds (0-59)" VALIDATE="integer" REQUIRED="Yes">
  52. </PRE>
  53. <P><INPUT TYPE="Submit" NAME=""> <INPUT TYPE="RESET">
  54.  
  55.  
  56. </CFFORM>
  57.  
  58.  
  59.  
  60. </BODY>
  61.  
  62. </HTML>        
  63.