Link to home
Create AccountLog in
Avatar of skb73
skb73

asked on

Date Time in Coldfusion

I have this in the my code
<cfset curDate = #Now()#>
<cfinvokeargument name="actiondttm" value=#curDate#/>

it saves the Date but not the time .. How do I get current Date/time stamp ??
ASKER CERTIFIED SOLUTION
Avatar of duncancumming
duncancumming
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
if you are saving to a database, try using createODBCDateTime( function
Avatar of gdemaria

 most databases have a date function built in, so if you just want to put the current date/time into the database, the easiest way is just do it in the datatbase's language.
 
 For example, if you're using SQL Server just say

 update mytable
  set  theDateColumn = getDate()
 where ....                        ^^^^ gives the date and time


If you need to do it in coldfusion for some reason do it like this..

 update mytable
  set  theDateColumn = #createODBCdateTime(now())#

or if using a function parameter...

 update mytable
  set  theDateColumn = #createODBCdateTime(arguments.actiondttm)#

Avatar of skb73
skb73

ASKER

My bad ! Now() did it and I useed CF_SQLTYPE_TIMESTAMP to save it as date/time