So first import datetime:from datetime import datetime
from datetime import datetime
Then import pytz and import timezone:from pytz import timezone
from pytz import timezone
Then you can do this:
tz = timezone("US/Eastern") date = datetime.now(tz) print("Current date and time: ") print(date.strftime("%Y-%m-%d %H:%M:%S"))
So I have set the timezone to US/Eastern. There are specific codes for timezones. You can find them here
US/Eastern
or if you want import it yourself:
import pytz for tz in pytz.all_timezones: print(tz)
Hope this helps y'all
Good job :)
So first import datetime:
from datetime import datetime
Then import pytz and import timezone:
from pytz import timezone
Then you can do this:
So I have set the timezone to
US/Eastern
. There are specific codes for timezones. You can find them hereor if you want import it yourself:
Hope this helps y'all
Good job :)