How would I get the current timestamp in python of India?
I tried time.ctime()
and datetime.utcnow()
also datetime.now()
but they all return a different time than here it is in india.
The codes above return the time that not match the current time on my computer. and the time in my computer is definitely correct.
from pytz import timezone
from datetime import datetime
ind_time = datetime.now(timezone("Asia/Kolkata")).strftime('%Y-%m-%d %H:%M:%S.%f')
print(ind_time)
>>> "2020-08-28 11:56:37.010822"