home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / createodbcdate.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  2.4 KB  |  64 lines

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