How to get current UK time in Google App Engine

前端 未结 3 1917
你的背包
你的背包 2020-12-19 11:53

Under python on my machine I can run datetime.now() to get the local time. If I inspect time.daylight flag it is set to 1 because we a

3条回答
  •  忘掉有多难
    2020-12-19 12:53

    AppEngine is a distributed system, whose servers can be located in different datacenters around the globe (afaik, currently EU and USA). Note that the python code you are running runs on the server not in the browser, so you'll never get the client's time. To get clients' time you'll need to use JavaScript and then send it to server.

    GAE servers' timezone is always set to UTC. Since UTC is in summer time one hour off from UK time, you are getting an hour difference.

    See this blog series for time handling on GAE: http://www.learningtechnicalstuff.com/2010/01/supporting-timezones-in-google-app.html

提交回复
热议问题