CreateODBCDate

Description

Returns a date in ODBC date format.

Category

Date and time functions

Syntax


CreateODBCDate(date) 

See also

CreateDate, CreateODBCDateTime

Parameters

Parameter
Description
date
Date/time object in the range 100 AD - 9999 AD. Year values 0-29 are interpreted as 21st century dates. Year values 30-99 are interpreted as 20th century dates

Example

<!---------------------------------------------------------

This example shows how to use CreateDate, CreateDateTime, and createODBCdate 

----------------------------------------------------------->



<html>



<head>

<title>

CreateODBCDate Example

</title>

</head>



<basefont face = "Arial, Helvetica" size = 2>

<body bgcolor = "#FFFFD5">



<H3>CreateODBCDate Example</H3>



<cfif IsDefined("FORM.year")>

Your date value, presented using different CF date functions:

<cfset yourDate = CreateDateTime(FORM.year, FORM.month, FORM.day,

  FORM.hour, FORM.minute, FORM.second)>

<cfoutput>

<UL>

  <LI>Built with CreateDate:

   #CreateDate(FORM.year, FORM.month, FORM.day)#

  <LI>Built with CreateDateTime:

    #DateFormat(CreateDateTime

     (FORM.year,FORM.month,FORM.day, FORM.hour, FORM.minute,

      FORM.second))#

  <LI>Built with CreateODBCDate: #CreateODBCDate(yourDate)#

  <LI>Built with CreateODBCDateTime: #CreateODBCDateTime(yourDate)#

</UL>



<P>The same value can be formatted with dateFormat:

<UL>

  <LI>Built with CreateDate:

    #DateFormat(CreateDate

     (FORM.year, FORM.month, FORM.day), "mmm-dd-yyyy")#

  <LI>Built with CreateDateTime:

    #DateFormat(CreateDateTime

     (FORM.year, FORM.month, FORM.day, FORM.hour,

      FORM.minute,FORM.second))#

  <LI>Built with CreateODBCDate:

    #DateFormat(CreateODBCDate(yourDate), "mmmm d, yyyy")#

  <LI>Built with CreateODBCDateTime:

    #DateFormat(CreateODBCDateTime(yourDate), "d/m/yy")#

</UL>

</cfoutput>

</cfif>



<cfform action = "createODBCdate.cfm" method = "POST">

<P>Please enter the year, month and day in integer format for 

the date value you would like to view:

<PRE>

Year  <cfinput type = "Text" name = "year" value = "1998"

    validate = "integer"

 required = "Yes">

Month  <cfinput type = "Text" name = "month" value = "6" RANGE = "1,12"

 message = "Please enter a month (1-12)" validate = "integer"

  required = "Yes">

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">

Hour  <cfinput type = "Text" name = "hour" value = "16" RANGE = "0,23" 

 message = "You must enter an hour (0-23)" validate = "integer"

  required = "Yes">

Minute  <cfinput type = "Text" name = "minute" value = "12" RANGE = "0,59"

 message = "You must enter a minute value (0-59)" validate = "integer"

  required = "Yes">

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">

</PRE>

<P><input type = "Submit" name = ""> <input type = "RESET">

</cfform>

</body>

</html> 



Banner.Novgorod.Ru