The datetime
module allows for returning an integer representation of the weekday with:
weekday = dt.date.today().weekday()
However, this seems to be in UTC timezone (the default timezone for datetime
). How can I convert this weekday integer to be adjusted for a timezone such as GMT? What I am looking for is something like the following using the pytz
module:
weekday = dt.date.today().astimezone(pytz.gmt).weekday()
Is there an easy method of doing this so that the day reporting is accurate based on the shift in hours from the timezone? Thanks for any/all information.