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 ??
Web Development Software

Avatar of undefined
Last Comment
skb73

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
duncancumming

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Plucka

if you are saving to a database, try using createODBCDateTime( function
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)#

skb73

ASKER
My bad ! Now() did it and I useed CF_SQLTYPE_TIMESTAMP to save it as date/time
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck