LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-20-2011, 08:34 PM   #1
freemanl
LQ Newbie
 
Registered: Oct 2011
Posts: 1

Rep: Reputation: Disabled
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!
 
Old 10-21-2011, 03:15 AM   #2
k3lt01
Senior Member
 
Registered: Feb 2011
Location: Australia
Distribution: Debian Wheezy, Jessie, Sid/Experimental, playing with LFS.
Posts: 2,900

Rep: Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637
Quote:
Originally Posted by freemanl View Post
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.
 
Old 10-21-2011, 03:32 PM   #3
whk
Member
 
Registered: Jun 2005
Posts: 202

Rep: Reputation: 37
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

Last edited by whk; 10-21-2011 at 05:11 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fast(est) Linux distribution for web server EricO-Dev Linux - Server 3 04-20-2010 06:30 AM
Australian timezone on Linux girish_hilage Linux - Desktop 2 12-25-2008 04:25 AM
Changing the date to EST shiroh_1982 Programming 2 07-17-2006 02:06 AM
Linux IRC chat, tonight at 9PM EST. testforechozero General 1 07-14-2004 07:08 PM
change UTC to EST time zone. brian_eye Linux - Newbie 1 10-27-2003 05:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration