Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7771239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:36:07+00:00 2026-06-01T16:36:07+00:00

Please, observe: C:\dev\poc\SDR>python Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit

  • 0

Please, observe:

C:\dev\poc\SDR>python
Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pytz import timezone
>>> from datetime import datetime
>>> tz1=timezone('America/Los_Angeles')
>>> tz2=timezone('US/Pacific')
>>> ts1=datetime(2011,8,1,tzinfo=tz1)
>>> ts2=datetime(2011,8,1,tzinfo=tz2)
>>> ts1
datetime.datetime(2011, 8, 1, 0, 0, tzinfo=<DstTzInfo 'America/Los_Angeles' PST-1 day, 16:00:00 STD>)
>>> ts2
datetime.datetime(2011, 8, 1, 0, 0, tzinfo=<DstTzInfo 'US/Pacific' PST-1 day, 16:00:00 STD>)
>>> ts1.astimezone(tz1)
datetime.datetime(2011, 8, 1, 0, 0, tzinfo=<DstTzInfo 'America/Los_Angeles' PST-1 day, 16:00:00 STD>)
>>> ts2.astimezone(tz2)
datetime.datetime(2011, 8, 1, 0, 0, tzinfo=<DstTzInfo 'US/Pacific' PST-1 day, 16:00:00 STD>)
>>> ts1.astimezone(tz2)
datetime.datetime(2011, 8, 1, 1, 0, tzinfo=<DstTzInfo 'US/Pacific' PDT-1 day, 17:00:00 DST>)
>>> ts2.astimezone(tz1)
datetime.datetime(2011, 8, 1, 1, 0, tzinfo=<DstTzInfo 'America/Los_Angeles' PDT-1 day, 17:00:00 DST>)
>>>

Here is what I do not understand. US/Pacific (tz1) and America/Los_Angeles (tz2) are supposed to denote the same time zone, aren’t they? Then how come that datetime.astimezone called to move from one zone to another changes the hour?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:36:09+00:00Added an answer on June 1, 2026 at 4:36 pm

    Daylight Savings Time. Notice that the last two entries are listing PDT-1.

    astimezone takes into account DST, but only if it actually goes through its full logic.

    The first two astimezone calls in your example don’t go through the full logic, because they short-circuit (since the timezone they’re converting “to” already matches the one they’re converting “from”).

    (You might wonder why the initial datetimes aren’t using PDT already. This is because the datetime constructor doesn’t take into account daylight savings time, even if you pass it a timezone – it just sets the timezone blindly.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please, observe: PS Z:\dev> hg version Mercurial Distributed SCM (version 1.9.2) (see http://mercurial.selenic.com for
I am learning Python at the moment and I have hit an issue. Observe
Why does this happen? Please observe the following code: static class StringExtension { public
Please, observe the following simple program (based on the example from the protobuf-net project
I'm seeking a behaviour which combines that of VerticalAlign=Stretch and VerticalAlign=Top . Please observe
Please observe the following behavior: a = ufoo b = ub\xe1r # \xe1 is
Please note that Object.Watch and Object.Observe are both deprecated now (as of Jun 2018).
In my WPF UserControl I have this resource, please observe the comments in the
Please observe the following markup: <Style TargetType={x:Type MenuItem} x:Key=...> <Setter Property=HeaderTemplate> <Setter.Value> <DataTemplate> <ContentPresenter
Please suggest some good resources to start writing Java Web services.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.