Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 24th, 2006, 08:02 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default javascript to write out two different time zones

I am looking for a javascript (if possible) that will display two times from two different time zones at the foot of a page.

Like this:

TWL® NA Time: 5/24/2006 9:01:57 AM
TWL® EU Time: 5/24/2006 3:01:57 PM

If you take a look at this website, and scroll down to the bottom
http://www.teamwarfare.com/ you will se what I mean.

Can that be done with JavaScript, or is that more SS stuff? PHP or ASP maybe?

Any help appreciated.

Picco

www.crmpicco.co.uk
www.ie7.com
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
Reply With Quote
  #2 (permalink)  
Old May 25th, 2006, 10:18 AM
Friend of Wrox
 
Join Date: Nov 2005
Location: Rotterdam, , Netherlands.
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Maybe this awnser is not what your looking for but why don't you calculate the 2e time from one time and display 2 different times

__________________________________________________ ________
This is my junk I'm gona eat it
Reply With Quote
  #3 (permalink)  
Old May 25th, 2006, 10:55 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

thanks DJ Kat, this is my working script:

Code:
// Last Edit: CRM_25may06
/*
jstime.js
Clock for Paris, FR and New York, US to be displayed at the foot of all pages
Genuine code by Corneliu Lucian "KOR" Rusu mailto:corneliulucian(AROND)apropo.ro
*/
var wd=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
var D=[
['EU (Paris) Time:',60,60],//city,standard time zone(minutes), DST(minutes) 
['NA (New York) Time:',-300,60] // Six Hours behind GMT
]
function calc()
{
    var spans=document.getElementById('zonediv').getElementsByTagName('span');
    for(var i=0;i<D.length;i++)
    {
        var t=new Date();
        t.setTime(t.getTime()+(t.getTimezoneOffset()*60000)+((D[i][1]+D[i][2])*60000));//the zone's time
        var Dy=t.getFullYear();
        var Dd=t.getDate()<10?'0'+t.getDate():t.getDate();
        var Dm=t.getMonth()<10?'0'+(t.getMonth()+1):t.getMonth()+1;
        var Dh=t.getHours()<10?'0'+t.getHours():t.getHours(); 
        var Di=t.getMinutes()<10?'0'+t.getMinutes():t.getMinutes();
        var Ds=t.getSeconds()<10?'0'+t.getSeconds():t.getSeconds();
        var Dz=wd[t.getDay()];
        spans[i].firstChild.data=Dh+':'+Di+':'+Ds+' - '+Dz+' '+Dd+'/'+Dm+'/'+Dy;
    }
    //setTimeout('calc()',1000);
}
onload=function()
{
    var root = document.getElementById('zonediv');
    for(var i=0;i<D.length;i++)
    {
        root.appendChild(document.createTextNode(D[i][0]+' '));
        var sp=document.createElement('span');
        sp.appendChild(document.createTextNode(' '));
        root.appendChild(sp);root.appendChild(document.createElement('br'));
    }
    calc();
}
www.crmpicco.co.uk
www.ie7.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write a message board with javascript ? shenliujun Javascript 0 September 5th, 2004 07:36 PM
using asp to write javascript vivalet Classic ASP Basics 3 November 6th, 2003 02:02 PM
Different Time Zones patwadd Classic ASP Basics 0 September 28th, 2003 07:53 PM
New Feature: Time Zones bluckcuck Forum and Wrox.com Feedback 0 August 29th, 2003 05:54 PM
New Forum Feature: Time Zones bluckcuck General Announcements 0 August 29th, 2003 05:51 PM



All times are GMT -4. The time now is 09:11 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.