coldfusion - unable to understand the createdatetime usage -


i have timestamp in linux epoch format. going through existing code , found following:

<cfset timestampval  = 1337197600 /> <cfset newtimestampval  = dateadd("s", timestampval, createdatetime(1970, 1, 1, 0, 0, 0))/> 

looked @ coldfusion documentation dateadd , syntax dateadd("datepart", number, "date")

so in case, have s second, date in linux epoch format in place of number , don't quite understand why createdatetime(1970, 1, 1, 0, 0, 0)) required. understand linux epoch timestampformat time in seconds elapsed since jan 1, 1970. unable understand above part.

which part not understand? seem state reason.

cf date not start @ jan 1, 1970. therefore, need add x seconds start date.

you may use createdate() instead , ignore time.

<cfset timestampval = 1337197600> <cfset newtimestampval = dateadd("s", timestampval, createdate(1970, 1, 1))> 

see: why coldfusion's epoch time dec 30, 1899?


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -