Skip to content

Instantly share code, notes, and snippets.

@martin-lukac
Created June 15, 2012 06:37
Show Gist options
  • Save martin-lukac/2935042 to your computer and use it in GitHub Desktop.
Save martin-lukac/2935042 to your computer and use it in GitHub Desktop.
India Timezone pytz possible issue
#!/usr/bin/python
import pytz
from datetime import datetime
intz = pytz.timezone('Asia/Kolkata')
nowdt = datetime.now(intz)
todaydt = datetime(2012,6,15,tzinfo=intz)
assert(todaydt.tzinfo == nowdt.tzinfo)
print todaydt
print nowdt
@SachiYadav
Copy link

import datetime
import pytz
d_month = datetime.datetime.now(tz=pytz.timezone('Asia/Kolkata'))
print(d_month.strftime('%B %d, %Y'))

Hope this will be helpful.

@Tanay-dev
Copy link

Thanks for telling but can I write Delhi or Bangalore or Mumbai in place-off Kolkata

@SachiYadav
Copy link

SachiYadav commented Aug 17, 2020 via email

@Dernyt-TPE
Copy link

Thanks for telling but can I write Delhi or Bangalore or Mumbai in place-off Kolkata

Its the same for any. IST is taken from Kolkata only so No Problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment