pendulum icon indicating copy to clipboard operation
pendulum copied to clipboard

timestamp function returns wrong timestamp for timezone initialize now or atleast syntax is very misleading

Open pranav08 opened this issue 7 years ago • 1 comments

I am using Pendulum '2.0.5'

pendulum.now('Asia/Kathmandu').timestamp() 1564462471.720615

pendulum.now('Asia/Singapore').timestamp() 1564462476.96399

The timezone difference between Kathmandu and Singapore is 2.25 hr, but above shows just 5 seconds different. Coincidence is that I executed both of them in 5 secs different.

As you can see, the syntax is misleading which I never expected. I kept debugging my code when there was issue with pendulum.

pranav08 avatar Jul 30 '19 05:07 pranav08

Looks like the timestamp() funciton is unix timestamp which returns UTC seconds. And this is same across all timezones. Hence closing the issue.

pranav08 avatar Jul 30 '19 05:07 pranav08