How to pick a timezone based on UTC offset?
问题 i've got a silly problem. I'm parsing Facebook user data, and I get the timezone as a number: timezone: The user's timezone offset from UTC For me ( 'America/Argentina/Buenos_Aires' ) it's -3. Now, how can I convert that number to a pytz.timezone ? Thank you! 回答1: There's not a 1:1 correspondence, so there's no way to do it without making some assumptions that are bound to be invalid. You can create your own tzinfo class that encodes the offset directly without trying to tie it back to a zone