Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old November 20th, 2003, 12:42 PM
szms szms is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 107 szms User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
How to change the day light saving time automatically.

The following code is giving me the old time but I want to have the day light savings time i.e it should be 9:35 a.m. now but it's giving me 10:35 a.m. instead. Can you please help me?

php Code:
Original - php Code
  1.  
  2. var yourMessage = "..........Welcome To MyWebsite.........................................  .";
  3.  
  4. // You may edit the message below.
  5. function getCurrentTime () {
  6.    var day="";
  7.    var month="";
  8.    var myweekday="";
  9.    var year="";
  10.    newdate = new Date();
  11.    mydate = new Date();
  12.    dston =  new Date('April 4, 1999 2:59:59');
  13.    dstoff = new Date('october 31, 1999 2:59:59');
  14.    var myzone = newdate.getTimezoneOffset();
  15.    newtime=newdate.getTime();
  16.  
  17.    var zone = 3// references your time zone
  18.  
  19.    if (newdate > dston && newdate < dstoff ) {
  20.       zonea = zone - 1 ;
  21.       dst = "  Atlantic Canada Daylight Savings Time";
  22.    }
  23.    else {
  24.       zonea = zone ; dst = "Atlantic Canada Time";
  25.    }
  26.    var newzone = (zonea*60*60*1000);
  27.    newtimea = newtime+(myzone*60*1000)-newzone;
  28.    mydate.setTime(newtimea);
  29.    myday = mydate.getDay();
  30.    mymonth = mydate.getMonth();
  31.    myweekday= mydate.getDate();
  32.    myyear= mydate.getYear();
  33.    year = myyear;
  34.  
  35.    if (year < 2000)    // Y2K Fix, Isaac Powell
  36.    year = year + 1900; // http://onyx.idbsu.edu/~ipowell
  37.    myhours = mydate.getHours();
  38.    if (myhours >= 12) {
  39.       myhours = (myhours == 12) ? 12 : myhours - 12; mm = " PM";
  40.    }
  41.    else {
  42.       myhours = (myhours == 0) ? 12 : myhours; mm = " AM";
  43.    }
  44.    myminutes = mydate.getMinutes();
  45.    if (myminutes < 10){
  46. mytime = ":0" + myminutes;
  47.    }
  48.    else {
  49.       mytime = ":" + myminutes;
  50.    }
  51.    arday = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
  52.    armonth = new Array("January ","February ","March ","April ","May ","June ","July ","August ","September ", "October ","November ","December ")
  53.    ardate = new Array("0th","1st","2nd","3rd","4th","5th","6th","7th","8th","9th","10th","11th","12th","13th","14th","15th","16th","17th","18th","19th","20th","21st","22nd","23rd","24th","25th","26th","27th","28th","29th","30th","31st");
  54.    // rename locale as needed.
  55.  
  56.    return  myhours + mytime+ mm + ", " + arday[myday] +", " + armonth[mymonth] +" "+ardate[myweekday] + ", " + year+", " + dst +"..............................";
  57. }
  58.  
  59. function startStatusScroller () {
  60.    window.status = statBarMsg;
  61.    statBarMsg = statBarMsg.substring(1, statBarMsg.length) + statBarMsg.substring(0, 1);
  62.    setTimeout("startStatusScroller()", 150);
  63. }
  64.  
  65. function updateStatusBarMsg () {
  66.    statBarMsg = yourMessage + getCurrentTime();
  67.    setTimeout("updateStatusBarMsg()", 60000);
  68. }
  69.  
  70. updateStatusBarMsg()


Reply With Quote
  #2  
Old November 20th, 2003, 11:30 PM
postalcow postalcow is offline
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Ford CIty, PA USA
Posts: 1,267 postalcow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
Send a message via Yahoo to postalcow
RE: How to change the day light saving time automatically.

I found this script/tutorial to do just what you want.
Blindeddie is the Java King, he might have a better way.
He usally answers all my Java questions

https://lists.xcf.berkeley.edu/lists/advanced-java/2003-July/019575.html

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > How to change the day light saving time automatically.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway