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.
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.
>
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.
>>
>
>