Welcome to Stackoverflow!
I'm not going to give everything away, but if you want the time to be unequivocally correct (even if the client's computer is set to the wrong date), you'll have to use something like TimeAPI.
If you want to make sure that it works in a specified timezone, with leap years, etc, the Date object should do the trick:
var x = new Date();
var currentTimeZoneOffsetInHours = x.getTimezoneOffset() / 60;
To deal with DST, it's more complicated, but the general concensus is just to use the UTC method of the Date object:
var d=Date.UTC(2012,02,30);
This will make sure you're not crossing any timezone boundaries. There are several questions similar to this one on SO, so feel free to search.