I've been figuring seconds since 1970 for online transactions.
I've been figuring it using a function I wrote. For some reason, when we switch back and forth from daylight savings time, I have to adjust the GMT-x value.
This is how I'm doing it now:
I thought I saw somewhere here where there is an API call to do this which would probably be more efficient, but I can't find it.
Does anyone know of it?
Maybe what I should be asking is, is there a way to determine if the computer running this program is using daylight savings time?
I've been figuring it using a function I wrote. For some reason, when we switch back and forth from daylight savings time, I have to adjust the GMT-x value.
This is how I'm doing it now:
Code:
FUNCTION secondsSince1970() AS LONG d$ = DATE$ today&&=date2serial(d$) hippie&& = date2serial("01/01/1970") difference&& = today&&-hippie&& 'this is the seconds to today grossSeconds&&= difference&&*86400 '((difference&&*24)*60)*60 'minutes for full days 'now figure out the seconds of today t$ = TIME$ lt&& = VAL(PARSE$(t$, ANY ":", 1))* 3600 'hours to seconds mt&& = VAL(PARSE$(t$, ANY ":", 2))* 60 'minutes to seconds rt&& = VAL(PARSE$(t$, ANY ":", 3)) 'seconds FUNCTION=grossSeconds&& + lt&& + mt&& + rt&&+21600 'I'm about 6 hours (GMT-6 = central standard time) 'short so add 18000 seconds back (5hrs) in : or 21600 '(6hrs) depending on if in daylight savings time END FUNCTION
Does anyone know of it?
Maybe what I should be asking is, is there a way to determine if the computer running this program is using daylight savings time?
Comment