Notice: With the launch of Adobe Cookbooks, this site will no longer be accepting new entries or posting new content. Thanks to everyone who submitted content!

You need to get the current date/time from the server.

The Now() function can be used to obtain the current date/time from the ColdFusion server:

The current date/time is returned as a date/time object, formatted as a timestamp:

{ts '2002-04-01 10:04:17'}

The object is formatted as {ts 'yyyy-mm-dd HH:mm:ss'} where ts indicates a time stamp. The date is formatted as a four-digit year followed by a two-digit month and a two-digit day. The time portion of the object is formatted for a 24-hour clock. Hours, minutes, and seconds are all formatted using two digits.


This question was written by Rob Brooks-Bilson.
It was last updated on January 5, 2006 at 5:55:31 PM EST.

CFML Referenced

Now()
<cfoutput>

Categories

Dates/Times

Comments

There are no comments for this entry.