0

I want to display the current time of a specific country/city on a page. I do not want to use any web-service for this. Is there any way to input the Country or City name (like: New York/ San Francisco) and get the current time or just offset value so that the current time can be calculated using it.

Thanks in advance!

andrewb
  • 5,200
  • 6
  • 36
  • 54
user199354
  • 505
  • 1
  • 5
  • 17

1 Answers1

0

Try this

var date = new Date();
var hour = date.getHours();
var min = date.getMinutes();

Because javascript runs on browser

Amit
  • 15,217
  • 8
  • 46
  • 68
  • 1
    It'll Just display the current time of users machine. It won't display the time according to a specific country. – user199354 Apr 28 '14 at 12:33
  • @user199354 Use as below `http://stackoverflow.com/questions/6797569/easiest-way-to-get-city-name-using-geolocation` – Amit Apr 28 '14 at 12:35
  • Is there any other way than to use a web-service or something? – user199354 Apr 28 '14 at 12:40
  • @AmitAgrawal How does that link help "get the current time or offset of a specific country/city name"? I'm afraid I don't see the relevancy. – andrewb May 05 '14 at 04:50