Closed bjoernpollex closed 7 years ago
Hi @bjoernpollex .fromtimestamp
returns local date and time. As you can see now the date is correct.
In [22]: datetime.fromtimestamp(timegm(f.modified_on.timetuple()), pytz.UTC)
Out[22]: datetime.datetime(2017, 9, 20, 8, 2, 43, tzinfo=<UTC>)
In [23]: f.modified_on
Out[23]: datetime.datetime(2017, 9, 20, 8, 2, 43)
To add all times are in UTC. Timezone information is not present. UTC is used always. The information is returned in ISO8601 format.
Ha, timezones! - I should have expected that I'd screw this up. Thanks for the clarification!
The attributes
created_on
andmodified_on
ofsevenbridges.models.file.File
don't have associated timezone information (andf.modified_on.tzinfo is None
isTrue
), and they are not UTC timestamps either.Specifically, given a file
f
on the platform, the following is not true:In my case the difference is exactly one hour. Ideally these timestamps would always be UTC, but if they are not, they should at least have timezone information.