python - Time zone field in isoformat -


I have a timestamp that should be in EST:

  2014-10- 06T18 : 06: 40-04: 56   

I think this is the first part: 2014-10-06T18: 06: 40 , but not -04 : 56 .

What is the -04: 56 here? `

Here's how I got that timestamp:

  import datetime start_time = datetime.tat time (year = 2014, month = 10, day = 6 , Hours = 18, tzinfo = pytz.timezone ('US / Eastern')) end_time = start_time + datetime.timedelta (seconds = 400)   

and then:

  end_time.isoformat ()   

returns:

  2014-10-06 T18: 06: 40-04: 56   

The problem is that:

one ?? Documentation is different from Python API for tzinfo implementation; If you want to create a local wall arch, you will need to use the documentation localizing () method in this document. |

Further down, it says: / p>

Unfortunately for many timezones using the standard datetime constructor's tzinfo logic, "Pitaj does not work" ".

  & gt; & Gt; & Gt; Date Time (2002, 10, 27, 12, 0, 0, Tezino = Amsterdam) .strftime (fmt) '2002-10-27 12:00:00 LMT + 0020'   

Therefore, what you should do is suggest docs, using the normalize , using UTC time and using osteomazone , etc. You are trying to do this for example:

  & gt; & Gt; & Gt; That time import from datetime & gt; & Gt; & Gt; Peataz Import Timezone & gt; & Gt; & Gt; UTC = Timezone ('UTC') & gt; & Gt; & Gt; Eastern = Timezone ('US / Eastern') & gt; & Gt; & Gt; Date time (2014, 10, 6, 18, tzinfo = east) .isoformat () '2014-10-06T18: 00: 00-04: 56' & gt; & Gt; & Gt; Before. General (that time (2014, 10, 6, 18, tezinfo = east)). IF format () '2014-10-0618 18: 56: 00-04: 00' & gt; & Gt; & Gt; DataTime (2014, 10, 6, 18, Tezinfo = UTC). Stimmon (Eastern) .isoformat () '2014-10-06T14: 00: 00-04: 00' & gt; & Gt; & Gt; Eastern.localize (date (2014, 10, 6, 18)) isoformat (). '2014-10-06T18: 00: 00-04: 00'   

I think this is the last one you should have. As a document for localization , say:

Convert in inexpensive time in local time

This method instead of localtimes Passing should be used. A tzinfo logic for a datetime maker

And I think building a local time is exactly what you wanted here.


Why are you thinking about a ?? | Well, if you have that data in your Olsson database, or just print out east._utcoffset , you will see -1 day, 68,640 minutes. This is 19.0166+ hours, not 19. Why? Since each timezone is defined with its starting offset, with adjustment from there. The time zone of Eastern New York 1883 is based on 18 November, 12:03:58, at which point it was from -04: 56: 02 GMT. There is an adjustment for dates starting in 1920 which decreases the excess. And of course an hour behind the annual adjustment DST. So, as of now, Eastern-04: 00, but no date is known about what date it shows, it is -04: 56. And, because the date asks a time zone for the bus instead of replacing it, compensate it at a particular time, that is what it is.


One last thing: . EST Eastern's Standard Time, which is -05: 00, is not the time zone for any location in the United States on October 6, 2014, because in 2014, America's Daylight Savings Time goes on November 2. (There were counties in Indiana who were on EST during the summer, but do not stay now.) What do you want, EDT, Eastern Daylight Time, which is -04: 00. Or, of course, ET, which is ADT during the summer and EST during winter, which you can call US / Eastern> or 'America / New York' .

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -