Page 1 of 1
unix time stamp
Posted: Thu Feb 24, 2011 2:26 am
by reelstuff
I am curious if there is a method of generating a time stamp that would work in the unix system as a time stamp for setting a date and time, in a standalone.
I did not see any references in the docs or the dictionary, so just wondering if it is out there but just not documented.
I know in PHP I can,
mktime(hour, minute, second, month, day, year)
in Javascript,
var unixtime = Date.parse("25-Feb-2011 17:57:35").getTime()/1000
anyone know how this can be done using livecode?
Re: unix time stamp
Posted: Fri Feb 25, 2011 3:57 pm
by FourthWorld
See dateItems in the Dictionary, e.g.:
put the date into tVar
convert tVar to dateItems
Re: unix time stamp
Posted: Fri Feb 25, 2011 3:59 pm
by FourthWorld
FourthWorld wrote:See dateItems in the Dictionary, e.g.:
put the date into tVar
convert tVar to dateItems
Which gives you:
2011,2,25,0,0,0,6
The Dictionary explains what each of those means.
You may also like the Internet date:
put the internet date
That gives you:
Fri, 25 Feb 2011 06:58:41 -0800
Re: unix time stamp
Posted: Fri Feb 25, 2011 4:08 pm
by reelstuff
That is interesting, what I am doing is using a desktop app to generate a script, part of that script process requires a valid unix time stamp, (in the future)
Funny thing when I used the search feature in the dictionary for unix date or time it showed no results, I also tried time and day, in the search but nothing happened, but sure enough when I used date items it showed the info,
I may need to revisit my script because I think that converting from live code format to unix may be somewhat of a challenge.
Thanks for posting that it does help, it looks like most of the data is already there, it may be that I am not grasping the array concept entirely.