Converting to Seconds

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Tester2
Posts: 102
Joined: Wed May 18, 2011 7:02 pm

Converting to Seconds

Post by Tester2 » Tue Jun 12, 2012 12:57 am

The current time is 4:00PM.

I have the time "4:30 PM" in a field called Time.

How can I figure out the difference between these in seconds?

Obviously the current time can be captured (put the seconds into tCurrentTime).

I tried the following:

convert field Time to seconds

put merge (tCurrentTime - field Time) into tNotificationTime

...but this did not work.

Please help soon!

Thanks bunches...

-Tester2

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Converting to Seconds

Post by sturgis » Tue Jun 12, 2012 1:15 am

time is a reserved word. This is why you should always quote your object names (and avoid using reserved words anyway)

convert field "time" to seconds


Also, merge does a placeholder replacement.

So if you have put merge("The time is now [[the short time]]")

The time is now 4:00 PM

In the case of what you want to do merge isn't really the right tool.

just: put time1 - time2 into field "myTimeField" should work fine.

CALL-151
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 206
Joined: Wed Oct 20, 2010 11:00 am

Re: Converting to Seconds

Post by CALL-151 » Fri Jun 15, 2012 2:30 pm

Tester2,

Sarah Reichelt developed some comprehensive date and time scripts that you may find to be a valuable resource. They are scattered around the Web, e.g. at http://www.troz.net/rev/index.irev?cate ... ary#stacks and http://support.runrev.com/scriptingconferences/

Post Reply