Skip to content

Instantly share code, notes, and snippets.

@deepwilson
Last active February 8, 2019 08:29
Show Gist options
  • Save deepwilson/7278213d00dfa00792fd1d05d6e5e434 to your computer and use it in GitHub Desktop.
Save deepwilson/7278213d00dfa00792fd1d05d6e5e434 to your computer and use it in GitHub Desktop.
Get current timestamp in IST
# Python3
from datetime import datetime
from pytz import timezone
curent_timestamp_ist = int(datetime.now(timezone('Asia/Kolkata')).timestamp())
# Convert to HH:M:SS
import time
curent_timestamp_ist += 19800
time.strftime("%H:%M:%S", time.gmtime(curent_timestamp_ist))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment