The server logs are two hours behind for whatever reason. I'm trying to at 2 hours because of the local time. At the moment, my script outputs in the following format:
2023-06-07 15:10:50+02:00
I actually need it to be:
2023-06-07 17:10:50
Here is the script:
import datetime
import pytz
vcenter_timestamp = '2023-06-07T15:10:50.065397578Z'[:19]
rome_tz = pytz.timezone('Europe/Rome')
pattern = '%Y-%m-%dT%H:%M:%S'
# time in UTC
dt = datetime.datetime.strptime(vcenter_timestamp, pattern)
# convert to Rome time with daylight savings
dt_rome = dt.astimezone(rome_tz)
print(dt_rome)
Current output:
2023-06-07 15:10:50+02:00
Expected output:
2023-06-07 17:10:50