unix time stamp

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Contact:

unix time stamp

Post by reelstuff » Thu Feb 24, 2011 2:26 am

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?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: unix time stamp

Post by FourthWorld » Fri Feb 25, 2011 3:57 pm

See dateItems in the Dictionary, e.g.:

put the date into tVar
convert tVar to dateItems
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: unix time stamp

Post by FourthWorld » Fri Feb 25, 2011 3:59 pm

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
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Contact:

Re: unix time stamp

Post by reelstuff » Fri Feb 25, 2011 4:08 pm

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.

Post Reply