For time.timezone, the Python documentation says:
The offset of the local (non-DST) timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK).
Does anybody know why it returns a negative value for most of Western Europe? These countries are in a positive offset, and not in a negative one.
Example: Brussels is in UTC+1 timezone...
A negative offset indicates that the time is west of UTC and a positive offset indicates that the time is east of UTC. Year offset. Year offset indicates the difference in years between the current Gregorian year and the current year in the calendar used with the time zone for your system.
The timezone, in general, is used to display the conversion of date and time between timezones, which means it is used to display the timezone it is using to print the time and date. In Python, the timezone is related to time concepts where two modules display timezones are time module and datetime module.
It basically refers to the local time of a region or country. Most of the time zones are offset from Coordinated Universal Time (UTC), the world's standard for time zone. In order to get the current time of different time zones, we will be using the pytz python library.
This is a Unix artefact. Although the standard numeric description for timezones is in hours and minutes east from UTC (UTC+1 for Brussels, UTC-5 for New York, etc.) the Unix timezone
is measured in seconds west from UTC.
From http://pubs.opengroup.org/onlinepubs/7908799/xsh/tzset.html:
The external variable
timezone
is set to the difference, in seconds, between Coordinated Universal Time (UTC) and local standard time, for example:
TZ timezone
EST 5*60*60
GMT 0*60*60
JST -9*60*60
MET -1*60*60
MST 7*60*60
PST 8*60*60
As to why Unix has it backwards, I'd guess it's a historical accident, probably because Unix was originally developed in the USA.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With