DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: What's the right time????

  1. #1
    Coilin Riley Guest

    What's the right time????


    Friends,

    As a newbie to Java, I am writing my first small app which requires me to
    store the current time. I live in the UK and currently we are running one
    hour ahead of GMT due to daylight saving changes. This is causing me no end
    of problems when I try and return the hour from the Calendar class as it
    always returns the GMT time and not the BST time!!!!

    This is what I have so far (using example time of 23:15)

    Public class DateTest {
    public static void main (String [] args) {
    int a;
    Calendar c = Calendar.getInstance();
    a = c.get(Calendar.HOUR_OF_DAY)
    System.out.println(a);
    }
    }
    In the above case a would be set to 22 - the GMT hour (not 23 as I want).
    Can anyone tell me of a quick way to ensure that the result I bring back
    reflects the correct time.

    Thanks

    Col.


  2. #2
    Paul Clapham Guest

    Re: What's the right time????

    This bug was fixed in Java 2, I believe.

    PC2

    "Coilin Riley" <colin.riley@iname.com> wrote in message
    news:3b0d91a7$1@news.devx.com...
    >
    > Friends,
    >
    > As a newbie to Java, I am writing my first small app which requires me to
    > store the current time. I live in the UK and currently we are running one
    > hour ahead of GMT due to daylight saving changes. This is causing me no

    end
    > of problems when I try and return the hour from the Calendar class as it
    > always returns the GMT time and not the BST time!!!!
    >
    > This is what I have so far (using example time of 23:15)
    >
    > Public class DateTest {
    > public static void main (String [] args) {
    > int a;
    > Calendar c = Calendar.getInstance();
    > a = c.get(Calendar.HOUR_OF_DAY)
    > System.out.println(a);
    > }
    > }
    > In the above case a would be set to 22 - the GMT hour (not 23 as I want).
    > Can anyone tell me of a quick way to ensure that the result I bring back
    > reflects the correct time.
    >
    > Thanks
    >
    > Col.
    >




  3. #3
    Tom Guest

    Re: What's the right time????


    "Paul Clapham" <pclapham@core-mark.com> wrote:
    >This bug was fixed in Java 2, I believe.
    >
    >PC2
    >
    >"Coilin Riley" <colin.riley@iname.com> wrote in message
    >news:3b0d91a7$1@news.devx.com...
    >>
    >> Friends,
    >>
    >> As a newbie to Java, I am writing my first small app which requires me

    to
    >> store the current time. I live in the UK and currently we are running

    one
    >> hour ahead of GMT due to daylight saving changes. This is causing me no

    >end
    >> of problems when I try and return the hour from the Calendar class as

    it
    >> always returns the GMT time and not the BST time!!!!
    >>
    >> This is what I have so far (using example time of 23:15)
    >>
    >> Public class DateTest {
    >> public static void main (String [] args) {
    >> int a;
    >> Calendar c = Calendar.getInstance();
    >> a = c.get(Calendar.HOUR_OF_DAY)
    >> System.out.println(a);
    >> }
    >> }
    >> In the above case a would be set to 22 - the GMT hour (not 23 as I want).
    >> Can anyone tell me of a quick way to ensure that the result I bring back
    >> reflects the correct time.
    >>
    >> Thanks
    >>
    >> Col.
    >>

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center