Results 1 to 4 of 4
  1. #1
    Jack_Maloney is offline Member
    Join Date
    Mar 2011
    Posts
    6
    Rep Power
    0

    Default Daylight Saving Problem

    Hi,

    I have a problem with daylight saving. So on Sunday in the UK the clocks went back one hour and the timezone changed from BST to GMT. Im getting a one off problem in my code in that if I add say ten hours to a Date object on the day the clocks changed I get the following problem: so adding 10 hours to Sun Oct 30 00:00:00 BST 2011 I want it to say: Sun Oct 30 10:00:00 GMT 2011 but instead it says: Sun Oct 30 09:00:00 GMT 2011. On all other days it works fine as expected. I know that this is because technically there are 2 X 1 o'clocks on that day so there is an extra hour hence the reason it says 9am. However, does anyone know a way around this problem??

    Thanks,
    Jack

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,656
    Blog Entries
    7
    Rep Power
    21

    Default Re: Daylight Saving Problem

    Create your own TimeZone object, don't specify DST for it and give it to your Calendar so that it doesn't use DST (your TimeZone object equals GMT+00:00)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Jack_Maloney is offline Member
    Join Date
    Mar 2011
    Posts
    6
    Rep Power
    0

    Default Re: Daylight Saving Problem

    When you say "Don't specify DST for the TimeZone object" how do you actually go about doing this? Theres no option to set the DST to false for a particular timezone object...

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,656
    Blog Entries
    7
    Rep Power
    21

    Default Re: Daylight Saving Problem

    Quote Originally Posted by Jack_Maloney View Post
    When you say "Don't specify DST for the TimeZone object" how do you actually go about doing this? Theres no option to set the DST to false for a particular timezone object...
    For existing TimeZones, the DST is implied; for the user defined TimeZones there is indeed no DST defined ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Saving objects problem
    By BennyJass in forum Networking
    Replies: 2
    Last Post: 01-15-2011, 10:49 PM
  2. Daylight Chart 2.6
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 04-22-2008, 04:35 PM
  3. Daylight Chart 1.6
    By levent in forum Java Software
    Replies: 0
    Last Post: 08-03-2007, 04:41 PM
  4. Daylight Chart 1.4
    By levent in forum Java Software
    Replies: 0
    Last Post: 06-10-2007, 01:30 PM
  5. Daylight Chart 1.3
    By levent in forum Java Software
    Replies: 0
    Last Post: 05-17-2007, 08:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •