0

I am working on a feature that displays the last saved time of a blog post based on the timezone of the user's browser. In Javascript I can use var currentTime = new Date();.

I want to do the same in python. Searching on SO, I found

import time
import datetime
import dateutil

now = datetime.datetime.utcfromtimestamp(time.time())
tzlocal = dateutil.tz.tzlocal()
print tzlocal.tzname(now)

from this post. However, it returns 'PDT' instead of my browser timezone which I set to 'EST' which is also what var currentTime = new Date(); returns (EST). What am I missing here?

tausabao
  • 247
  • 1
  • 3
  • 11

0 Answers0