| Author |
DST & Actual Date
|
Anand Bala
Greenhorn
Joined: Jan 19, 2004
Posts: 8
|
|
How to find out DST begin and end date in every year(US - CST)? I know DST starts in first Sunday of April and ends in last Sunday of October. Here is my actual issue. For a any given date, my method will add given number of days and return the date. Here is what my code look like... private static final long DAY_MILLIES = 24*60*60*1000; long datemillies = fromDate.getTime(); datemillies += (DAY_MILLIES*no_of_days); return new java.sql.Date(datemillies); It works fine if this happens within DST or actual time. But I gave DST time (eg.Sep 9 2005) and add some number of days (eg 90 days) which is returning the actual(non-DST) time. Here is the issue. I didn't count the last Sunday of october is 25 hours day. So I am getting the wrong date back. I am looking on the java api, but no luck yet. Could someone help me on this. Thanks, [ August 28, 2005: Message edited by: Anand Bala ]
|
 |
Rick O'Shay
Ranch Hand
Joined: Sep 19, 2004
Posts: 531
|
|
|
What you have there is fine because you are working with relatively absolute values -- not a contradiction but a description. All you need is a Calendar: see GregorianCalendar.
|
 |
Anand Bala
Greenhorn
Joined: Jan 19, 2004
Posts: 8
|
|
Thanks Rick. I looked at the GregorianCalendar api and it has some sample code for that. It works. [ August 28, 2005: Message edited by: Anand Bala ]
|
 |
 |
|
|
subject: DST & Actual Date
|
|
|