CreateODBCDateTime

Description

Returns a date/time object in ODBC timestamp format.

Category

Date and time functions

Syntax


CreateODBCDateTime(date) 

See also

CreateDateTime, CreateODBCDate, CreateODBCTime, Now

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

Usage

When passing a date/time value as a string, enclose it in quotes. Otherwise, it is interpreted as a number representation of a date/time object.

Example

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

This example shows how to use CreateDate, CreateDateTime, 

and createODBCDateTime 

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

<html>

<head>

<title>

CreateODBCDateTime Example

</title>

</head>



<body bgcolor = silver>

<H3>CreateODBCDateTime 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 = "createODBCdatetime.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