The Daily Click ::. Forums ::. Klik Coding Help ::. Getting seconds till
 

Post Reply  Post Oekaki 
 

Posted By Message

Ando



Registered
  08/04/2006
Points
  100
2nd March, 2008 at 16:19:18 -

Hello friends. I need help. D:

I'm trying to get an application to be able to use a given time and figure out how many seconds are left until that time. The time is anywhere from an hour to a week away. What do I use to do this?

 
n/a

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
2nd March, 2008 at 17:10:19 -

60 seconds per minute
60 minutes per hour
24 hours per day
7 days per week
365.2525 days per year

HOWEVER, I recommend you use something like the Timestamp object. That stores any date in the number of seconds since the unix epoc (a date in the 1980's I think, Wikipedia will have it).

So, find the time and date you're starting from with the Timestamp's 'get today' expression, and the timestamp for the target date.

target date - today = seconds between the two

Should work

 
191 / 9999 * 7 + 191 * 7

Ando



Registered
  08/04/2006
Points
  100
2nd March, 2008 at 18:01:26 -

Oh wow. That was bloody simple. I'd never used the TimeStamp object before so I wasn't entirely sure how it functioned. Works like a champ.

Thank you very much, sir.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click