new Date() without time zone

Asked

Viewed 6,757 times

1

I have to send a date javascript for my controller through the FullCalendar. In my action, I’m getting one DateTime and need to send through the javascript file with the new Date(minha_variavel).

But when I do, they come with the time zone of -3 o'clock, ie if I select day 10/08/2015 00:00:00 in the FullCalendar, I get in the controller the following date: 09/08/2015 21:00:00.

Is there any way to date without that happening?

  • He may be using GMT. Try changing to UTC or changing your time zone on OS, I think it could work.

  • this documentation page can help: http://fullcalendar.io/docs/timezone/timezone/

  • tlz help http://answall.com/questions/72294/string-para-date [missed link]

  • Have you ever thought of using momentjs to manage this?

1 answer

2

when working with dates the best alternative is to work with momentjs

but Voce could use:

var d = new Date('10/08/2015 00:00:00');
d.toLocaleString() // 08/10/2015 00:00:00
d.toString(); //Thu Oct 08 2015 00:00:00 GMT-0300 (Hora oficial do Brasil)
d.toGMTString();  //Thu, 08 Oct 2015 03:00:00 GMT
d.toUTCString();  //Thu, 08 Oct 2015 03:00:00 GMT

Browser other questions tagged

You are not signed in. Login or sign up in order to post.