[issue22994] datetime buggy

2014-12-05 Thread santhosh
santhosh added the comment: Thanks simeon.visser, I understood your point. Didn't got your point earlier. Hey belopolsky, Here is the solution val=datetime.datetime.strptime("2015-02-01",'%Y-%m-%d').date() zon=pytz.timezone('US/Pacific') Bad Code: dt=datetime.datetime(val.year,val.month,val.day

[issue22994] datetime buggy

2014-12-04 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: It looks like pytz documentation [1] specifically warns about this kind of usage: """ Unfortunately using the tzinfo argument of the standard datetime constructors ‘’does not work’’ with pytz for many timezones. """ [1] http://pytz.sourceforge.net/#loc

[issue22994] datetime buggy

2014-12-04 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: santhosh, I would be interested to know how this gets resolved. I find it strange that zon gets fractional UTC offset: >>> zon If you ask on a pytz-related forum, please post a link here. Some other cases: >>> pytz.timezone('US/Eastern') >>> pytz.

[issue22994] datetime buggy

2014-12-04 Thread R. David Murray
R. David Murray added the comment: pytz is not a part of the python standard library, it is a 3rd party product. Please reread Simeon's message (he's talking about any timezone), and if you have further questions ask on whatever support forum pytz has, or on the python-list mailing list. ---

[issue22994] datetime buggy

2014-12-04 Thread santhosh
santhosh added the comment: zon=pytz.timezone('America/New_York') dt=datetime.datetime(2014,02,01, tzinfo=zon) print dt,zon => 2015-02-01 00:00:00-04:56 America/New_York zon=pytz.timezone('Asia/Kolkata') dt=datetime.datetime(2014,02,01, tzinfo=zon) print dt,zon =>2015-02-01 00:00:00+05:53 Asia

[issue22994] datetime buggy

2014-12-04 Thread santhosh
santhosh added the comment: i dont need local timezone i need other timezones like: (US/Pacific) -- ___ Python tracker ___ ___ Python-

[issue22994] datetime buggy

2014-12-04 Thread Simeon Visser
Simeon Visser added the comment: Datetimes in local timezones should be created using localize(): >>> zon.localize(datetime.datetime(2015, 2, 1)).isoformat() '2015-02-01T00:00:00-08:00' See the two supported methods of creating local datetimes at: http://pytz.sourceforge.net -- nosy:

[issue22994] datetime buggy

2014-12-04 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +belopolsky ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue22994] datetime buggy

2014-12-04 Thread santhosh
New submission from santhosh: val=datetime.datetime.strptime("2015-02-01",'%Y-%m-%d').date() zon=pytz.timezone('US/Pacific') dt=datetime.datetime(val.year,val.month,val.day, tzinfo=zon) print dt,zon output: 2015-02-01 00:00:00-07:53 US/Pacific output should be 2015-02-01 00:00:00-08:00 US/Paci