Link to home
Start Free TrialLog in
Avatar of brihol44
brihol44

asked on

DateFormat / Timestamp

I know this should be easy but I can't seem to find out the following. If I'm using a JavaScript calendar and the formatting is yyyy/mm/dd when a date is selected. How can input the the yyyy/mm/dd formated text to a timestamp so I can format the date however I need to in the future.  For example : {ts '2007-07-26'} format.

Thanks,

Brian
Avatar of Scott Bennett
Scott Bennett
Flag of United States of America image

just use parsedatetime:

#ParseDateTime(form.fieldName)#
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That is not neccessary. yyyy/mm/dd is indeed how coldfusion expects it for the parsedateeimt function. You would only have to do the createDate method if you were using yyyy/dd/mm and then it would be :
<cfset theDate = createDate( listFirst(theString,"/"), listLast(theString,"/"), listGetAt(theString,2,"/") )>

try it out:
<cfset mydate="2007/12/1">
<cfoutput>#parsedatetime(mydate)#</cfoutput>