Skip to content

Instantly share code, notes, and snippets.

@rudSarkar
Created April 9, 2022 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rudSarkar/a6dff1308446d633c3d144305080b57a to your computer and use it in GitHub Desktop.
Save rudSarkar/a6dff1308446d633c3d144305080b57a to your computer and use it in GitHub Desktop.
get local time using pytz and datetime
import pytz
from datetime import datetime
BST = pytz.timezone('Asia/Dhaka')
datetime_bst = datetime.now(BST)
get_local_time = datetime_bst.strftime('%I:%M%P')
# Get more strftime : https://strftime.org/
print(get_local_time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment