Created
September 23, 2022 18:40
-
-
Save luisgdev/bcbe745e39998b3efd3022abbeb65581 to your computer and use it in GitHub Desktop.
Get timezone of certain location
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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