converting Date and time to seconds

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
tasdvl9
Posts: 94
Joined: Fri Dec 06, 2013 3:55 am

converting Date and time to seconds

Post by tasdvl9 » Wed Apr 23, 2014 3:03 am

Hello,

I've been searching quite a bit and haven't been able to figure out the 'livecode' way to convert this string to seconds..
1/1/08 3:06 AM

Any ideas?

Thanks!

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: converting Date and time to seconds

Post by Simon » Wed Apr 23, 2014 3:21 am

Take a look at "convert" in the dictionary.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

tasdvl9
Posts: 94
Joined: Fri Dec 06, 2013 3:55 am

Re: converting Date and time to seconds

Post by tasdvl9 » Wed Apr 23, 2014 3:29 am

Thanks for the response.

I tried using something like this:
convert tNewDateTo from date and long time to seconds

To no avail.

Converting the date is easy. But suppose you want to do a compare on not only the date but the time as well?
I thought perhaps you could convert both the date to seconds and then the time to seconds and add both but that was uneventful
as well.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: converting Date and time to seconds

Post by Simon » Wed Apr 23, 2014 3:42 am

hmmm
This is from the dictionary examples
convert the date && the time to seconds
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: converting Date and time to seconds

Post by Dixie » Wed Apr 23, 2014 3:53 am

Code: Select all

on mouseUp
   put "1/1/08 3:06 AM" into theTime
   convert theTime to seconds
   put theTime
end mouseUp

tasdvl9
Posts: 94
Joined: Fri Dec 06, 2013 3:55 am

Re: converting Date and time to seconds

Post by tasdvl9 » Wed Apr 23, 2014 4:51 am

Thanks, Guys!

My syntax was incorrect thus causing my issue.

I appreciate all of the responses :)

Post Reply