TimeZone is off by one hour

Hi folks,
I use the TimeZone.getDefault() and TimeZone.getTimeZone("America/Los_Angeles") to print the date string. They are both off by one hour and the timezone string is "GMT-08:00" intead of "PDT". The OS is Debian. When I type the date command, it shows "Tue Mar 29 17:56:18 PDT 2011" which is correct. What other settings can be wrong?
Thanks!

The problem must be from the default. The useDayLight is false. I am using Debian, where can I set the right defualt timezone for Java?
TimeZone.getDefault():
sun.util.calendar.ZoneInfo[id="GMT-08:00",offset=-28800000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
03/30/2011 15:15:14 GMT-08:00
TimeZone.getTimeZone("America/Los_Angeles"):
sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]
03/30/2011 16:15:14 PDT
TimeZone.getTimeZone("GMT"):
sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
03/30/2011 23:15:14 GMT

Similar Messages

  • Calculating Elapsed Time Is Off By One Hour

    I am fully aware of many topics discussed in the various forums here related to the OS timezone and DST settings impacting how the JVM will process date/time calculations. I am running on Windows XP Professional, and I have checked and double checked the timezone setting, it is correctly set to Central Time and the "Automatically adjust clock for daylight saving changes" checkbox is checked.
    The code found at the end of this message clearly shows the problem for which I have yet to find an explination. I intended to be able to use a timer to update a string to show how much time has elapsed since the start of anything for which I need to know this information. As you can see by the results (example of which is listed after the code), the timezone and DST offsets seem to be properly retrieved by the JVM, but if this is the case, then why is the elapsed time value off by one hour?
    I am looking for a solution/explanation involving the date/time classes, not a workaround whereby I end up extracting multiple time representation subsets and manipulating them myself. Any help will be greatly appreciated.
    * TestTimeZone.java
    * Created on September 12, 2004, 7:18 PM
    import java.io.*;
    import java.util.*;
    import java.awt.event.*;
    import java.sql.*;
    import java.text.*;
    * @author  Jared
    public class TestTimeZone {
        java.util.Date startDt;
        /** Creates a new instance of TestTimeZone */
        public TestTimeZone() {
         * @param args the command line arguments
        public static void main(String[] args) {
            new TestTimeZone().go();
        private void go() {
            startDt = new java.util.Date();
            TimeZone tz = TimeZone.getDefault();
            System.out.println("the default timezone is " + tz.getDisplayName(true, TimeZone.LONG));
            System.out.println("the default timezone ID is " + tz.getID());
            System.out.println("useDaylightTime = " + tz.useDaylightTime());
            System.out.println("default locale = " + Locale.getDefault().toString());
            javax.swing.Timer t = new javax.swing.Timer(1000, new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    java.util.Date currDt = new java.util.Date();
                    Calendar cal = Calendar.getInstance();
                    long elapsedTime = currDt.getTime() - startDt.getTime() -
                        (cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET));
                    SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
                    System.out.println("Elapsed: " + formatter.format(new java.util.Date(elapsedTime)) +
                        " Start: " + formatter.format(startDt) +
                        " Current: " + formatter.format(currDt));
            t.start();
            while (true) try {
                Thread.sleep(10);
            } catch (Exception e) {
                e.printStackTrace();
    }And here is the result I am seeing:
    the default timezone is Central Daylight Time
    the default timezone ID is America/Chicago
    useDaylightTime = true
    default locale = en_US
    Elapsed: 23:00:01 Start: 00:03:57 Current: 00:03:58
    Elapsed: 23:00:02 Start: 00:03:57 Current: 00:03:59
    Elapsed: 23:00:03 Start: 00:03:57 Current: 00:04:00
    Elapsed: 23:00:04 Start: 00:03:57 Current: 00:04:01
    Elapsed: 23:00:05 Start: 00:03:57 Current: 00:04:02
    "

    Great. Now that we have gotten half way to the goal, please let me know how you intend to get that difference in miliseconds presented as a time value using any of the date/time classes Java has to offer. That way, I don't have to rewrite the code that puts it into a properly formatted String (the kind folks at Sun have already written that code). Using date/time classes to acheive this is what I attempted with my application. I added the milisecond adjustments for TZ and DST because if I didn't the reported elapsed time would be off by 6 hours, not just 1.
    I am open to all suggestions.

  • Exchange / Google calendar entries off by one hour after DST

    I noticed that all of my repeating entries from my Google calendar on my iPhone (synced with the Exchange "Google sync" method) were off by one hour, appearing one hour delayed, starting November 7th, 2010 and ending in March 2011 when DST starts again. After turning Time Zone Support off in the iPhone settings, everything fixed. However, this is unfortunate if it means I don't have the ability to shift my calendar when I travel. Anyone else experience this problem, or know of an actual fix (as opposed to this work-around)?

    Woraround: Turn on time zone support in the mail calendar settings and choose your location. Downside is you have to change it if you are traveling. I thin apple should address this as a bug.

  • Calendar sync time off by one hour

    When I sync my BB Curve 8530, version 5.0, by Verizon with Outlook 2007 calendar, the appointment time is off by one hour.  The BB Curve always shows the appt time one hour later than Outlook.  When I schedule an all day event, it begins at 1 am and carries over to the next day at 1 am.  I've verified time zone settings for both.  Not sure what else to do or check.  Any advice is greatly appreciated so I won't be late again!!! 
    Looney2ndad

    Update, I now have several accounts that reporting the same issue. Has anyone else seen this?

  • IPhone 3G Email and Calendar times off by one hour (slow one hour)

    My times which I send/receive emails or put appointments on the calendar are 1 hour slow as compared to my computers. I have Mobile Me and Mobile Me (on the computer) and my Outlook emails and calendars match and my current time is correct on all. On the IPhone 3G the current time is correct but the time a email is sent or received and all appointments on the calendar are both off by one hour (one hour slow on the IPhone 3G).
    I have set time automatically in "settings" to on, and under "email contacts and calendar" I have time zones disabled. I have tried each possible combination of these settings but cannot get the email/calendar times to match between my computers and the IPhone 3G regardless of how these are set.
    I have numerous computers and all times are correct on all. On the IPhone 3G the current time (the clock) is correct, but times in emails and calendar appointments are all off (slow) by exactly one hour no matter what I do.
    Anybody else have this issue, and/or know what the solution might be?
    Thanks
    The Omega

    I have tried that and it did not work. I am now trying it with everything set to enable DST, and see if that works. Everything, so far, seems to be in sync. The phone would be right for a second when you went into the calendar and then change to be an hour off. Strange. I think the settings I have now (all, Windows, MobileMe, and the IPhone 3G set to DSL on, the same) may be working. Only time will tell.
    Thank you.
    The Omega

  • I have a Ipod shuffle 4th generation. I would like for the music to shut off after one hour long song automatically rather than go to the next song. Is this possible?

    I have an ipod shuffle 4th generation. I would like for the music to automatically shut off after one hour long song rather than going to next song on the list. Is this possible?

    Sorry, but it's not.  The only way to get this to work is to only put the one hour song on your Shuffle. 
    B-rock

  • Appointments are off by one hour

    after syncing my i-phone my i-cal shows the appointments as one hour later. I-phone still shows them correctly. I checked and my macbook pro is set for EDT just like my i-phone.
    Any solutions?

    Should be an issue with the time zone settings on all Outlook clients involved.
    Has Gmail/Yahoo account mentioned here been configured into Outlook clients?
    If you are using Outlook 2010 you need to use a time zone with the correct DST settings for your location. If your location does not observe DST, do not choose a time zone that does then deselect the option to automatically update for daylight saving time.
    You need to use a time zone that does not observe DST.
    http://www.slipstick.com/outlook/calendar/meeting-requests-and-appointments-are-off-by-one-hour/
    Kapaal

  • Appointments are showing off by one hour for Yahoo users

    Ok, I know there have been a few responses to this, but none seem to fit the exact issue I am having, so I'm going to ask again.
    I have two users in particular, one on Outlook 2010 and one on Outlook 2013. They have hosted Exchange, and the Exchange server is 2007. The Exchange host provider is located in the Central Time Zone. Computers for my users are all set to correctly to Eastern
    Time Zone. Windows 7 and 8.1 machines with all updates installed are what the users are using. I also logged into the hosted OWA option and set the time zone to EST there as well.
    When I send an invite from Outlook 2010 user to another Exchange server, meeting time in the email invite BEFORE accepting shows the correct time zone for that user, and stays correct when accepting. When I send an invite to Gmail, again, shows
    correct time before and after accepting. When I send to a Yahoo account, it shows the time one hour behind before accepting - essentially shows the CST time. Once I accept the meeting in Yahoo, it shows the correct time in the Yahoo calendar, but the email
    with the invite still shows the wrong time, one hour earlier. And obviously if the user doesn't accept the invite but just uses it as a guide, they will show up one hour earlier.
    Is this an issue for Yahoo, or Exchange 2007? It might be possible to move my client from Exchange 2007 to 2010 or 2013, but I don't want to do that if it won't fix the problem.

    Should be an issue with the time zone settings on all Outlook clients involved.
    Has Gmail/Yahoo account mentioned here been configured into Outlook clients?
    If you are using Outlook 2010 you need to use a time zone with the correct DST settings for your location. If your location does not observe DST, do not choose a time zone that does then deselect the option to automatically update for daylight saving time.
    You need to use a time zone that does not observe DST.
    http://www.slipstick.com/outlook/calendar/meeting-requests-and-appointments-are-off-by-one-hour/
    Kapaal

  • Meetings input on iPhone off by one hour in iCal due to End of Daylight Sav

    Dear all,
    All my appointments input through my iPhone (taking place after Sunday October 26) is off with one hour. When I go to details in iCal it says "Etc/GMT -2". I live in Copenhagen so it should be GMT -1.
    On Sunday it is the End of Daylight Savings Time so the imported appointments are "right" compared to the time today. But obviously I would not like to have to correct all appointments next week pushing them one hour ahead....
    My regional settings on iPhone and Macbook Pro look right.
    Whats wrong?
    Thank you in advance.
    Anders Rasmussen

    Got this from another discussion post and it worked. On your iPhone, drill down Settings>Mail,Contacts, Calendars and drop down to Calendars. My Time Zone was ON and set to an offset of GMT, I turned it OFF and my appointments are at the correct time on my iPhone.

  • Why is the time stamp for delivered  vtext off by one hour?

    Why is the time stamp for delivered  vtext off by one hour?

    This is  a known bug. After midnight it will correct itself. Apple is aware of it.

  • IPhone 5 time off by one hour.

    I just purchased a new Sprint iPhone 5 last week. This morning I woke up and the clock was off by exactly one hour. I tried turning the phone on and off and resetting it to no avail. Finally I went into settings > date & time and turned on and off the automatic time function and it fixed the problem for about 4 hours; however, just now it reverted to being incorrect. Anyone have any ideas as to what might be going on? I'm running IOS 6.1.3 which I believe is the most current version.
    Thanks!

    It just now went off by an hour again, under the timezone field it says "etc/GMT+6" instead of chicago. I'm thinking this is probably a Sprint problem??

  • Timezone is off by 1 hour on somewebsites

    If I visit certain sites with event information, the time is off by 1 hour (early) in Firefox only.
    If I visit the same site with Internet Explorer, Chrome or Safari, the time is correct.
    How do I set the time zone in FireFox?

    Yes, they all show the time the same. (on your link)
    I asked a few friends to try those sites I mentioned and they all said the time was correct in FF.
    I just upgraded one of the computers to latest version of Firefox and it now shows the time correctly on that website and others.
    I have auto-update turned off, as it can be annoying if you are somewhere on slow wifi and it says "time remaining" for upgrade '18 hours' ...
    Hope this fixes the 'crashing' as well, that version crashed at least once per day ... it was rather annoying ... and I tend to use FF more than other browsers. But it always recovered with all the tabs intact.
    All 4 browsers are on 1 computer, all connected to internet same, no proxy servers or anonymizers, just straight forward.
    So, it seems this is due to bug in version 23.0.1?
    Browsers are different ... you can not use Chrome, IE or Safari on this page ... hit the Reply button and absolutely nothing happens ... no reply box. Strange that Mozilla site hates everyone but Firefox :-)
    Thanks for your help!

  • Calendar item off by one hour after daylight savin...

    Hi,
    When I accept an outlook meeting invitation from my phone (Lumia 520) it gets into the phone´s calendar one hour earlier than sceduled in the invitation.
    I have checked settings, the outlook invite as well as my phone has the same timezone settings (western europe), though phone settings is "Auto".
    It seems like phone does not handle calendar invite items correctly after the switchover to standard(winter) time. For information; when the Outlook meeting item is sent to other calendar systems (e.g. other outlook server or google calendar) the meeting is registerred correctly.
    Does anyone have any clue how to solve this issue?
    Thanks,
    //Christian

    Hi ceggertsen,
    Are you using your Microsoft account? How often do you experience this? Can you try to create a test invitation using another exchange account and then see if it's the same? Also, try to set your manually set your time, date, and time zone and see if it will make any difference. 
    Let us know the outcome.

  • Calendar Off by One Hour

    Since I updated to iOS5, my calendar is behind by one hour.  I have checked both timezone settings and both are accurate.  Help?

    When you check the time zone, you also need to click on it to see what city you are tied to.  A map will pop up with the city name.  When I switched from a city in Guatemala to Minneapolis, I got back to Daylight Savings time. 

  • Scheduled Fax - Time off by one hour

    If I schedule a fax job on a remote computer and select "Send at" via the scheduler drop-down, it behaves differently in Tiger (10.4.6) than in Panther (10.3.9).
    In Panther, it works as I would expect. The default time is the current time, and when you schedule the job, the remote system has the same time as you set.
    In Tiger, the default time that comes up is 6:00PM , and when you change this time and schedule the job, the remote computer schedules it for one hour ahead of your time.
    I have verified that the time zone settings are the same on all computers, and it does the same whether the shared fax is on a Tiger system or a Panther system.
    PowerBook G4 1.5Ghz SuperDrive   Mac OS X (10.4.6)  

    Update, I now have several accounts that reporting the same issue. Has anyone else seen this?

Maybe you are looking for

  • Purchase Orders Using BAPI_PO_CREATE1

    Hi guys , when v want to upload PO data using BAPI FM wat r the Strutures to be passed Is it necessary 2 pass Xstructures if So? why ? can any one have sample Code Regards Anil kumar

  • Problem printing files to Adobe PDF printer using VBA

    I have an Excel project. Part of the code prints the active sheet range as a PDF file. Later code then sends the PDF file as an e-mail attachment. The Code was originally written using the free application PDFCreator and works as intended. However th

  • Putting apps database in Read-Only mode

    Hi, I want to put the apps database in read-only mode to that user will be able to login into the applications and see data but will not be able to update it. What is the best way to do this? Thanks

  • User report issues in 1.1.0.21.97

    A couple of issues i'm experiencing with user reports on Mac OS X in the latest pre-releas build first off, if I am asked for a password (first time I use the connection) there is no feedback if the connection fails (worng password for instance) The

  • Installation of ISO: With partitioning already done, where do I start?

    The document I refer to is: http://ebalaskas.gr/wiki/archlinux/netinstall#h254-14 My question is: Given that I have already used gparted to create a bootable partition, can I forego the first stages of the install procedure as set forth in the wiki (