User Guide Cancel

CreateODBCDateTime

 

Description

Creates an ODBC date-time object.

Returns

A date-time object, in ODBC timestamp format.

Category

Date and time functions

Function syntax

CreateODBCDateTime(date)
CreateODBCDateTime(date)
CreateODBCDateTime(date)

See also

CreateDateTimeCreateODBCDateCreateODBCTimeNowEvaluation and type conversion issues in Data type conversion in the Developing ColdFusion Applications

Parameters

Parameter

Description

date

Date-time object in the range 100 AD-9999 AD.

Note: In ColdFusion (2021 release), the createDateTime function supports time zones specified in the Application level settings. If you specify an invalid DateTime value, the createODBCDateTime function throws an exception.

Usage

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

Example

<cfscript>
year = 2018;
month = 11;
day = 02;
hour = 1;
minute= 09;
second= 46;
myDate=CreateDateTime(year,month,day,hour,minute,second)
format=CreateODBCDateTime(myDate)
writeOutput("Date and time format is : " & format);
</cfscript>
<cfscript> year = 2018; month = 11; day = 02; hour = 1; minute= 09; second= 46; myDate=CreateDateTime(year,month,day,hour,minute,second) format=CreateODBCDateTime(myDate) writeOutput("Date and time format is : " & format); </cfscript>
<cfscript>
    year = 2018;
    month = 11;
    day = 02;
    hour = 1;
    minute= 09;
    second= 46;
    myDate=CreateDateTime(year,month,day,hour,minute,second)
    format=CreateODBCDateTime(myDate)
    writeOutput("Date and time format is : " & format);
</cfscript>

Output

Date and time format is : {ts '2018-11-02 01:09:46'}

Get help faster and easier

New user?