Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7188801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:09:49+00:00 2026-05-28T19:09:49+00:00

I was looking for a similar issue here at Stackoverflow javascript multiple date display

  • 0

I was looking for a similar issue here at Stackoverflow javascript multiple date display related, but couldn’t find what I want.

Here this code: demo javascript date

I was trying to make the date based on different time zones for different cities. For example, I want to show the current date for New York in a div in this format:

Monday, January 30, 2012 

..and another city like London in a different div in the same format:

Monday, January 30, 2012

If the day changes, then the date changes as well. Is there a way how to add GMT time to each city so that I can have as many cities as possible to display?

If there is a better way and a lot simpler using JQuery for example, it would be a lot better since it is easy to play around with that tool.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:09:50+00:00Added an answer on May 28, 2026 at 7:09 pm

    you can use javascript as follow:

    Convert the local time to another time zone with this JavaScript

    <html>
    <head>
    <script language="JavaScript">
    
    // function to calculate local time
    // in a different city
    // given the city's UTC offset
    function calcTime(city, offset) {
    
        // create Date object for current location
        d = new Date();
    
        // convert to msec
        // add local time zone offset
        // get UTC time in msec
        utc = d.getTime() + (d.getTimezoneOffset() * 60000);
    
        // create new Date object for different city
        // using supplied offset
        nd = new Date(utc + (3600000*offset));
    
        // return time as a string
        return "The local time in " + city + " is " + nd.toLocaleString();
    
    }
    
    // get Bombay time
    alert(calcTime('Bombay', '+5.5'));
    
    // get Singapore time
    alert(calcTime('Singapore', '+8'));
    
    // get London time
    alert(calcTime('London', '+1'));
    
    </script>
    </head>
    <body>
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tried looking at similar problems, but could not easily find one that helped
I've been looking all over the site for a similar issue, but none of
I have an XML document looking similar to this: <items> <item cat=1 owner=14>bla</item> <item
I'm looking for something similar to the table creation form from phpmyadmin, but it
I'm looking for something similar to this: Active navigation with jQuery - can't apply
I'm looking for Forum software similar to phpBB, but intended to run within a
We have been having this issue pop up sporadically, but now I can reproduce
I've fallen foul of the find-in-files-isn't issue as suggested here and reported on Connect
Generally we traverse the array by row or column but here I want to
I have been looking for a solution to this issue for a few days

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.