Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CreateDateTime

Status
Not open for further replies.

programmher

Programmer
Joined
May 25, 2000
Messages
235
Location
US
I am trying to set ThisDate to equal CreateDateTime.

I declare the parameter below:


<cfparam name=&quot;ThisDate&quot; default&quot;&quot;>

I set the date:

<cfset ThisDate EQ #CreateDateTime('dd','mm','yy','hh:mm:ss')#>

Here is my error:

An error occurred while evaluating the expression:


ThisDate EQ #CreateDateTime('dd','mm','yy','hh:mm:ss')#


Parameter 1 of function CreateDateTime which is now &quot;dd&quot; must be an integer

What am I missing? I have used keyword search and have followed ALL the examples I found. I also tried declaring my cfparam's value to equal &quot;date&quot;. This did not work, either. What am I missing?!?



 
The function is expecting numbers or variables, the sript is trying to pas strings 'dd', but this won't work.

Syntax
CreateDateTime(year, month, day, hour, minute, second)

Example 1: 1/1/2001 12:00:00 AM
<cfset ThisDate = #CreateDateTime(2001,1,1,0,0,0)#>

Example 2: Today's Date - 12:00 00 PM
<cfset ThisDate = #CreateDateTime(Year(Now()),Month(Now()),Day(Now()),12,00,0)#>

Example 3: Today's Date - Current Server Time
<cfset ThisDate = #CreateDateTime(Year(Now()),Month(Now()),Day(Now()),Hour(Now()),Minute(Now()),Second(Now()))#>


If you want to get the current date and time, do the following:
<cfset ThisDate = #Now()#>
- tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top