I have a server time (east cost of USA) that I want to convert to user's local time regardless of his location. I don't know the user's time zone.
Here is a sample date stored in MongoDB (UTC time):
ISODate("2012-05-03T09:40:34.764Z") which becomes 5/3/2012 5:40:34 AM
I want to convert this to local time of the user.
Is there a plugin I can look at or someone has it done w/o plugin?
This my code which is not working:
var svrDate = new Date('5/3/2012 5:40:34 AM');
var tzo = ((new Date()).getTimezoneOffset() / 60) * (-1);
var userTime = new Date(svrDate.setHours(svrDate.getHours() + tzo)).toLocaleString());