Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Re: CFSET time to today at 9:00PM

$
0
0

You want the format, 'yyyy-mm-dd HH:MM:SS'. There are two ways to get it, depending on whether you are inserting the value into a datetime column or into a text column.

 

If you wish to save the value as a datetime column, then you should assign it as a date object. You can do that by modifying the datatype of the column to the required format. Alternatively, you can include a formatting function in the insert SQL statement for your particular database. It is then sufficient to represent the time as

 

<cfset mytime = now()>

 

If, however, the column is to be a text field (for example, char or varchar), then you could do something like this

 

<cfset mytime = dateFormat(now(), "yyyy-mm-dd") & " " & timeFormat(now(), "HH:MM:SS")>


Viewing all articles
Browse latest Browse all 21760

Trending Articles