Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

day light saving

 
Kowshik Nandagudi
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 75
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

You may use the inDaylightTime method on the TimeZone


Cheers,
Claudiu
 
Kowshik Nandagudi
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The above code returns false even though 30th october 2011 falls under DST
 
Claudiu Chelemen
Ranch Hand
Posts: 75
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, what's your timezone id ?

Claudiu
 
Kowshik Nandagudi
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TimeZone ID is "Europe/London"
 
Claudiu Chelemen
Ranch Hand
Posts: 75
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 48981
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but i dont want to specify the time. just need to know if dst applies on that day
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Winston Gutkowski
Bartender
Pie
Posts: 10417
63
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic