1

How can i get the guild.created_at time in the Europe/Berlin timezone? i tried guild.created_at.astimezone(timezone('Europe/Berlin')) and its doesnt work. i also tried other forums, tutorials and the docs, but with no success.

I've already looked at the options:

pytz localize vs datetime replace

http://pytz.sourceforge.net/

pytz - Converting UTC and timezone to local time

IBimsEinDomi
  • 31
  • 1
  • 8
  • `guild.created_at` returns creation time in UTC as `datetime.datetime`. See answer here (`pytz` example): https://stackoverflow.com/a/13287083/9083371 – Benjin May 11 '20 at 09:45

1 Answers1

2

You can make use of the fromutc function:

pytz.timezone('Europe/Berlin').fromutc(guild.created_at)
Finlay
  • 162
  • 1
  • 9