Ask coding questions

← Back to all posts
I am in the eastern time zone but when I run the program, the time output is 4 hours ahead of me.
EthanJohnson11 (3)

I don't think I need to specify my time zone. When I run the program on python on my PC, I get my local time.

Roar123 (443)

To make this work on, you should probably specify the timezone. By default, the timezone is Coordinated Universal Time, or UTC. Using gets the local time, but when using, the code is processed on their servers and sent back to you. I would imagine they would use UTC rather than their timezone. Here's a timezone example:

# Imports
from datetime import datetime
from pytz import timezone

# Set timezone
tz = timezone("US/Eastern")
# Date with timezone
date =

# Formatting
format_date = date.strftime("%d/%m/%Y %H:%M:%S")