You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a timestamp that I use to print a time useing this code:
Globalize.format(new Date(timestamp), "T");
This will result in different times according to witch timezone the client is in. Is there any easy way to provide a timezone (in my case +01) to Globalize and get dates and times corrected to this timezone?
Thanks
The text was updated successfully, but these errors were encountered:
Sorry for barging in, but you can write a simple function that does that.
Just make a new date and subtract you're current timezone offset from UTC.
Here's a simple example (CoffeeScript / Javascript):
get_new_date_in_local_time: (date) ->
date = new Date date
new Date date.getTime() + (date.getTimezoneOffset() * 60 * 1000)
getNewDateInLocalTime = function(date){
date = new Date(date);
return new Date(date.getTime() + (date.getTimezoneOffset() * 60 * 1000);
}
You can just put it inside globalize.js and use it.
Hi!
I have a timestamp that I use to print a time useing this code:
Globalize.format(new Date(timestamp), "T");
This will result in different times according to witch timezone the client is in. Is there any easy way to provide a timezone (in my case +01) to Globalize and get dates and times corrected to this timezone?
Thanks
The text was updated successfully, but these errors were encountered: