timestamp in any timezone

new topic     » topic index » view thread      » older message » newer message

I need a timestamp in seconds since 1/1/1970 0:0:0 UTC

The problem I'm getting is that it works here, in GMT, but the same code running in Texas is 6 hours (21600 seconds) adrift.

This is the (phix only) code I'm currently using:

include builtins\timedate.e 
 
timedate t0 = parse_date_string("1/1/1970 UTC",{"D/M/YYYY tz"}) 
 
function timestamp() 
    sequence d = date() 
    string res = sprintf("%d",{timedate_diff(t0,d,DT_SECOND)}) 
    return res 
end function 
 
?timestamp() 

Any suggestions?

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu