python - Timestamp with utc and any other timezone is coming out to be same with arrow -
import arrow print arrow.utcnow() print arrow.utcnow().timestamp print arrow.utcnow().to('asia/kolkata') print arrow.utcnow().to('asia/kolkata').timestamp
i need timestamp (in int) of 'asia/kolkata' timezone, +5:30 utc.
arrow.utcnow()
, arrow.utcnow().to('asia/kolkata')
coming out different , second 1 +5:30 first, expected.
however, arrow.utcnow().timestamp
, arrow.utcnow().to('asia/kolkata').timestamp
still coming out same.
i sure missing basic here, can explain this?
i think "timestamp", definition, in utc:
the unix time (or unix epoch or posix time or unix timestamp) system describing points in time, defined number of seconds elapsed since midnight proleptic coordinated universal time (utc) of january 1, 1970, not counting leap seconds.
if take localized time string, convert utc date time (that is, 5pm kolkata time becomes 5pm utc), can timestamp corresponds local clock time. example:
import arrow print arrow.utcnow() print arrow.utcnow().timestamp kolkata = arrow.utcnow().to('asia/kolkata') print kolkata.replace(tzinfo='utc').timestamp
Comments
Post a Comment