Skip to content

Instantly share code, notes, and snippets.

@luisgdev
Created September 23, 2022 18:40
Show Gist options
  • Select an option

  • Save luisgdev/bcbe745e39998b3efd3022abbeb65581 to your computer and use it in GitHub Desktop.

Select an option

Save luisgdev/bcbe745e39998b3efd3022abbeb65581 to your computer and use it in GitHub Desktop.
Get timezone of certain location
def get_vzla_date() -> str:
"""
Get Venezuela time in format DD/MM/YYYY.
:return: String with the date.
"""
dt = datetime.now(pytz.timezone("America/Caracas"))
day = dt.day if dt.day > 9 else f"0{dt.day}"
month = dt.month if dt.month > 9 else f"0{dt.month}"
return f"{day}/{month}/{dt.year}"
# result sample: "01/09/2022"
# You can find more timezones on pytz.all_timezones
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment