CreateDate

Description

Returns a valid date/time object.

Category

Date and time functions

Syntax


CreateDate(year, month, day) 

See also

CreateDateTime, CreateODBCDate

Parameters

Parameter
Description
year
Number in the range 100 - 9999. Year values 0-29 are interpreted as 21st century dates. Year values 30-99 are interpreted as 20th century dates.
month
Number in the range 1 (January)-12 (December)
day
Number in the range 1-31

Usage

CreateDate is a subset of CreateDateTime.

Time in the returned object is set to 00:00:00.

Example

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

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

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

<html>



<head>

<title> CreateDate Example</title>

</head>



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

<body bgcolor = "#FFFFD5">



<H3>CreateDate Example</H3>



<cfif IsDefined("FORM.year")>

Your date value, presented using different CF date functions:

<cfset yourDate = CreateDate(FORM.year, FORM.month, FORM.day)>



<cfoutput>

<UL>

  <LI>Built with CreateDate: #CreateDate(FORM.year, FORM.month,

      FORM.day)#

  <LI>Built with CreateDateTime: #CreateDateTime(FORM.year, FORM.month,

      FORM.day, 12,13,0)#

  <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, 12,13,0))#

  <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 = "createdate.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" 

    validate = "integer"

 required = "Yes">

Day  <cfinput type = "Text" name = "day" value = "8" validate = "integer"

 required = "Yes">

</PRE>

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

</cfform>





</body>

</html>    





Banner.Novgorod.Ru