aspose file tools*
The moose likes Java in General and the fly likes day light saving Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "day light saving" Watch "day light saving" New topic
Author

day light saving

Kowshik Nandagudi
Ranch Hand

Joined: Dec 09, 2010
Posts: 57
Hi

Can I know if my date falls in a dst? I dont want to specify the time but only the date

For example:

Claudiu Chelemen
Ranch Hand

Joined: Mar 25, 2011
Posts: 71

Hi

You may use the inDaylightTime method on the TimeZone


Cheers,
Claudiu
Kowshik Nandagudi
Ranch Hand

Joined: Dec 09, 2010
Posts: 57


The above code returns false even though 30th october 2011 falls under DST
Claudiu Chelemen
Ranch Hand

Joined: Mar 25, 2011
Posts: 71

Well, what's your timezone id ?

Claudiu
Kowshik Nandagudi
Ranch Hand

Joined: Dec 09, 2010
Posts: 57
TimeZone ID is "Europe/London"
Claudiu Chelemen
Ranch Hand

Joined: Mar 25, 2011
Posts: 71

I believe it looks also at the current time.
If you set the hour on the calendar to 0, will it return true ?

If I am not mistaken, DST ends at 01:00 GMT.

Claudiu
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39784
    
  28
Claudiu Chelemen wrote: . . . If I am not mistaken, DST ends at 01:00 GMT. . . .
That is correct. After 1.59am (BST) came 1.00am (GMT) on 30th October this year.
Kowshik Nandagudi
Ranch Hand

Joined: Dec 09, 2010
Posts: 57
but i dont want to specify the time. just need to know if dst applies on that day
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3737
    
  16
Kowshik Nandagudi wrote:but i dont want to specify the time. just need to know if dst applies on that day

From midnight until 1am it does, from 2am onwards it doesn't, between 1am and 2am I'm not sure because that hour happens twice. So the answer to whether DST applies on that day is yes and no. You'll have to decide how you are going to handle that.


Joanne
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8186
    
  23

Kowshik Nandagudi wrote:but i dont want to specify the time. just need to know if dst applies on that day

What Joanne said.

If you only need to know whether most or all of the day was in DST or not, set the time to 12 noon.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: day light saving