The Date object already has the ability to adjust dates from UTC to local time, though it depends on the correct configuration of the user's computer.
Originally Posted by tekboy
Adjust the target time to the equivalent UTC. For example, 1300 EST (USA: -5 hours) is 1800 UTC. If the target is a fixed date, use the Date.UTC method to obtain a timestamp, and then construct the Date object:
i want to put in a time like 1:00pm us time manually, how can i make this number automaticly change to whaterver time equivalent in user local timezone
Note that months start at zero, so 10 is November, not October.
var date = new Date(Date.UTC(2006, 10, 1, 18)); // 2006-11-01 18:00:00
If the target is based on the current date, use the setUTCHours method to change the hours, minutes, seconds, and milliseconds:
var date = new Date(); // Current time and date
date.setUTCHours(18); // Additional arguments set minutes, seconds, and ms
IP addresses do not correspond to countries, nor does country necessarily determine the necessary local time adjustments (especially in the USA, for example).
Originally Posted by tech_support