LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   EST of Australian timezone does not work (https://www.linuxquestions.org/questions/linux-newbie-8/est-of-australian-timezone-does-not-work-909245/)

freemanl 10-20-2011 08:34 PM

EST of Australian timezone does not work
 
Hello,

I'm new to slackware. I test EST daylight saving time. Time change in October works with no problem. But that in April does not work.

For example, I changed system time to Sun, 3 April 2011, 02:59:30.
After 30 seconds, it moved to 3:00:00. But it should not, it should turn back to 02:00:00 because daylight saving time end.

Does I miss something to do?
Any help would be greatly appreciated!

k3lt01 10-21-2011 03:15 AM

Quote:

Originally Posted by freemanl (Post 4503913)
Does I miss something to do?

Patience is a virtue, wait till daylight savings actually ends, my gut feeling is it will work when the time comes.

whk 10-21-2011 03:32 PM

Double check your calendar. April 3, 2011 is a Sunday. Ay.


Sat Apr 02 07:23:31 EST 2011 Eastern Summer Time (Victoria)
Sun Apr 03 06:23:31 EST 2011 Eastern Standard Time (Victoria)

Or double check your code.

Here's a simple Java Code on timezone (sorry it's messy)

Code:

import java.util.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;                                           
import java.util.Date;
class TimesAX
{
public static void main(String[] args)
{
int daysPast=202;    //insert days past

String sp="";
Date date = new Date();
Calendar calVictoria = Calendar.getInstance();
calVictoria.setTimeZone(TimeZone.getTimeZone("Australia/Victoria"));
TimeZone AusTZ = calVictoria.getTimeZone();
  String tzAName =
      AusTZ.getDisplayName(AusTZ.inDaylightTime(date), TimeZone.LONG);
  String tzANameSt =
      AusTZ.getDisplayName(AusTZ.inDaylightTime(date), TimeZone.SHORT);

  System.out.println("Time in Victoria: " + calVictoria.get(Calendar.HOUR_OF_DAY) + ":"
            +sp+ calVictoria.get(Calendar.MINUTE)
            +" tz "+ tzANameSt +" "+tzAName);
 

      System.out.print("\n");

TimeZone.setDefault(AusTZ);
Date AusDate = Calendar.getInstance(AusTZ).getTime();                 
System.out.println(AusDate);                                       
                                                                     
 DateFormat format17 =                                                 
 new SimpleDateFormat("EEEE-MMMM-dd-yyyy  h:mm a zz  Z");             
 System.out.println(format17.format(AusDate));
  System.out.println("180 days future      "+getDateAfterDays(180));
 
String tzAName2 =
      AusTZ.getDisplayName(AusTZ.inDaylightTime(getDateBeforeDays((daysPast+1))), TimeZone.LONG);
String tzAName3 =
      AusTZ.getDisplayName(AusTZ.inDaylightTime(getDateBeforeDays((daysPast))), TimeZone.LONG);

  System.out.println((daysPast+1)+" days past      "
    +getDateBeforeDays((daysPast+1)) +" "+tzAName2);
  System.out.println(daysPast+" days past      "
    +getDateBeforeDays(daysPast)+" "+tzAName3);

}
public static Date getDateAfterDays(int days) { 
 long backDateMS = System.currentTimeMillis() + ((long)days) *24*60*60*1000; 
 Date backDate = new Date(); 
 backDate.setTime(backDateMS); 
 return backDate; 
 }
public static Date getDateBeforeDays(int days) { 
 long backDateMS = System.currentTimeMillis() - ((long)days) *24*60*60*1000; 
 Date backDate = new Date(); 
 backDate.setTime(backDateMS); 
 return backDate; 
 }
}

Though, you might want to rewrite to new acronyms.
EDT Eastern Daylight Time UTC + 11 hours
EST Eastern Standard Time UTC + 10 hours
hth


All times are GMT -5. The time now is 07:03 AM.