Why does new Date() sometimes use different timezone?

I have date values stored as longs (milliseconds). I debug my app because I somehow get time parts that are not zero (00:00:00). Then I noticed this:
315529200000 : Tue Jan 01 00:00:00 CET 1980
1104447600000 : Fri Dec 31 00:00:00 CET 2004
1059602400000 : Thu Jul 31 00:00:00 CEST 2003
All values have a time of zero (correct) but show a diffetent time zone? How is that possible? I created the time strings all via the same
Systemn.out.println("Date of long: "+new Date(l));
The last number suddenly hast "CEST" instead of "CET" and therefore somewhere else lead to a time 23:00:00.

I just checked this simple case:
I have a date and add exactly 1 day and the result is not the original result + 1 day:
        long d1 = 1099173600000L; //2004-10-31 00:00:00
        System.out.println(new Date(d1));
        long d2 = 86400000L; //1 day in milliseconds
        long d3 = d1 + d2;
        System.out.println(new Date(d3)); //2004-10-31 23:00:00 !!!
]/code]
the output is:
Sun Oct 31 00:00:00 CEST 2004
Sun Oct 31 23:00:00 CET 2004
So, instead of added 1 day, this just added 23 hours!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Why does Input menu (to use different language) not appear?

    Hi, I am trying to enter special characters (German umlauts) into a Pages document. So far I am only able to do this via Edit > Special characters where I have to laboriously select and insert my character. So I checked the Help to use a different keyboard layout and got to the page titled "Viewing Keyboard Layouts for Other Languages" - I followed the steps exactly, but the so-called Input menu does not show on my Pages menu bar. Anything else I need to do? Any and all advice welcome - btw I am a new Mac user, I finally made the switch from PC to Mac, so I am still learning my way around.
    Thanks in advance!

    System Preferences > Language and Text > Input Sources tab. Top of the left column, tick (check) "Keyboard and Character Viewer", Bottom of window next to search field, tick "Show input menu in menu bar"
    System Preferences > Keyboard > Keyboard tab; tick "show keyboard and character viewers in menu bar"
    For most purposes there's no need to use character viewer or change input source. All the standard diacritical marks and common symbols can be accessed directly from the standard keyboard. ü is produced by pressing alt (option) + U, release them and type U. Similarly é is alt+e, followed by e.
    If you open Keyboard Viewer and press the alt (option) key, the location of the marks will be revealed. Note that five of them are highlighted in orange; these are the ones which can be used with multiple  letters (acute, umlaut, gràve, circumflex and tilda)
    Shift+Alt will show more.

  • Why does firefox want to use different fonts on mounted hard drives

    On Mac OS 10.6.5 using Firefox 3.6.12 upon opening Firefox, I get a dialog box that says "Firefox want to use the font "TremorlTC TT" on the volume "USB BU".
    This happens for both of my external hard drives. It gives me the options: Show in Finder Don't Allow or Allow. I have tried all 3 and neither solves the problem.

    Move all User fonts in Font Book to Computer fonts:
    # Launch Font Book (/Applications/Utilities/)
    # Open Font Book > Preferences
    # Deselect: "Automatic Font Activation"
    # Set the "Default Install Location" for fonts to Computer
    # Select all User fonts.
    # Move the selected User fonts to Computer fonts
    # Remove all duplicate fonts in Computer fonts

  • Why does my printe say "used supply in use/:

    why does my printer say used supply in use?  And I can't print anything

    Pretty sure its to make sure you don't get good use out of your cartridges... basically this company trying to get 10 cents a print out of you
    After 1100 prints, regardless of how much ink used, if you take it out (the genuine 85a) at this point and put it back in, say after a jam or you want to shake it, it tells you have a used cartridge, i have tested continually using this, and got 500 more prints, with an annoying nag that you cant stop from every page printed. you have to take it out because this printer is notorious for a section ink don't get too, even though there probably is over 50% of ink left in it.. you take it out and shake it and can print, hundreds and hundreds of more pages... but after the 1100 point mark, since the printer tracks statistics it goes into this "used mode" so averages of prints won't go up... im pretty sure its devious code... but what do i know.. i just wont be getting new HP printers.. they claim it can cause damage.... the heads are on the toner cartridge... if its damaged the cartridge is replaced and thats that... so their warnigs are smoke and mirrors..

  • Why does the scrollbar sometimes appear then disappear?

    Why does the scrollbar sometimes appear but then disappear? When I open a window the scrollbar is sometimes there for a just few seconds. If I select it within a few seconds and use it everything works fine. If I don't use it, it disappears and I can't get it back. How do I get the scroll bar back? Why won't the scrollbar show up at all on web pages?

    It's a feature which is supposed to enhance your interface with your Mac and its operating system on screen. It is a "visual aid" that is meant to remove on screen clutter.
    You can go to 'system prefs/ click general/ click 'Show scroll "Always button"
    There you go
    Cheers

  • Why does my ipod sometimes flashes white then shuts down and then the only way to restart is to restore?

    why does my ipod sometimes flashes white then shuts down and then the only way to restart is to restore?

    If you restored to factory settings/new iPod and still have the problem that indicates a hardware problem.
    Make an appointment at the Genius Bar of an Apple store..
    Apple Retail Store - Genius Bar

  • Why does my iphone4 sometimes say it can't move certain messages to Trash?ages in

    Why does my iphone4 sometimes say it can't move certain messages from my inbox to Trash?

    That would depend on how your wifi or cellular data signal is, if its weak you'll get that message.

  • Why does the Java API use int instead of short or byte?

    Why does the Java API use int if short or even byte would be sufficient?
    Example: The DAY_OF_WEEK field in Calendar uses int.

    One of the point is, on the benchmark tests on Java performance, int does far better than short and byte data types.
    Please follow the below blog talks about the same.
    Java Primative Speed
    -K

  • Why does the Date Created metadata change when images are exported?How do I stop it from changing?

    why does the Date Created metadata change when images are exported?  How do I stop it from changing? I must have a prefernce set up wrong.

    I don't know what OS you are using, or what application you are using to view the data about your exported files, but on Windows and using Windows Explorer the "Date Created" field relates only to the date that the exported file was created, i.e. if viewed immediately after export it will show the date created as being the same date. In order to view "Capture Date" in something like Explorer, you first have to ensure you have included the Metadata as Conrad outlined above, then you have to adjust the display properties of Explorer to show the "Date Taken" field. Here is an example, part of a folder I exported back on March 3rd, note the difference between that last two dates:

  • Why does it say im using 3.8gb of mail when my mail is deleted?

    why does it say im using 3.8gb of mail when my mail is deleted< yes even the trash

    Quit Mail. Force quit if necessary.
    Back up all data. That means you know you can restore the Mail database, no matter what happens.
    Triple-click the text on the line below to select it:
    ~/Library/Mail/V2/MailData/Envelope Index
    Copy the selected text to the Clipboard (command-C). In the Finder, select
    Go ▹ Go to Folder
    from the menu bar. Paste into the box that opens (command-V), then press return.
    A Finder window will open with a file selected. Move the selected file to the Desktop, leaving the window open. Other files in the folder may have names that begin with "Envelope Index". Move those files, if any, to the Trash.
    Log out and log back in. Relaunch Mail. It should prompt you to re-import your messages. You may get a warning that the index is corrupt and that Mail has to quit. Click OK.
    Test. If Mail now works as expected, you can delete the file you moved to the Desktop. Otherwise, post your results.

  • Why does my mac sometimes freeze when waking up?

    Why does my mac sometimes freeze when waking up?  It only happens sometimes, but also happens spontaneously.  21' iMac 2011 model.  It just started recenlty after a new firmware update from apple.  Any advice or reasons why would be appreciated.

    boot to lion recovery and run verify/repair on the hard drive. verify will say: appears to be okay OR needs to be repaired. No matter what outcome, you will repair anyways (as it will do some updating on the volume)
    Process: hold command R during startup/ wait till you see mac os utility (might have to select english as the main language first) then disk utility/ select macintosh HD on the left, and then verify/repair on the right bottom side. Cheers!

  • Why does my printe say "used supply in use" 1217nfw

    Why does my printe say "used supply in use" model m1217nfw

    Hello,
    The "Used Supply in Use" means that the printer believes the toner cartridges installed in the printer have been previously used in another printer.
    Have you recently changed the toner cartridge on this printer? Are you having issues printing?
    Remember if you find any of my post helpful or want to say thanks make sure to click the white star under my name to give me Kudos.
    I really appreciate it!
    You should be able to still print without problems even though the message comes up.
    THX

  • New Data Basis using infocbe 0BCS_C11

    Hi,
    I am creating new data basis using Infocube 0BCS_C11 in SEM BCS 4.0. Data Stream has been generated properly. Company and Consolidation Profit Center has been assigned Role ''Consolidation Unit'.
    However, I am not getting Company as characteristic in 'Authorization/Validity check' tab. I can see:
    Consolidation Group
    Consolidation Profir Center Group
    Consolidation Profit Center
    We are using Infocube 0BCS_C11 as we think that in future we might use Matrix Consolidation, though there is no current requirement. At present we are going to use Legal Consolidation only.
    Can you please advise?
    Best Regards,
    UR

    Solved. It was just saving and going out of the screen. Thanks

  • Why does Mobile Data notification keep coming up saying 'Mobile Data is turned off for "Numbers" and I have to click on OK to get rid of it? I KNOW it's turned off for that program because that is what I want it to be set at. What I DON'T want is to have

    Why does Mobile Data notification keep coming up saying 'Mobile Data is turned off for "Numbers" and I have to click on OK to get rid of it? I KNOW it's turned off for that program because that is what I want it to be set at. What I DON'T want is to have to click on OK EVERY TIME I open the program when I'm away from wifi.

    That is how it works in general, not just for Numbers. It irritates me on other apps at times, although I can see an argument that if it didn't do that then people would complain about missing functionality after they forgot they had turned data off for an app. At any rate, this is a user to user support forum and we can't do anything about it. If you want to make a suggestion to Apple, following is a place to do that: http://www.apple.com/feedback/

  • Does the creative cloud use different proxy settings as my works internet security (NHS) is potentially blocking connections?

    Does the creative cloud use different proxy settings as my works internet security (NHS) is potentially blocking connections?
    Can only update apps through my home internet connection.
    Any advice would be helpful.

    Quick update. Added to a previously filed bug. Looks like it's assigned now so maybe we'll see a fix for this soon.
    https://bugzilla.mozilla.org/show_bug.cgi?id=563169

Maybe you are looking for