6
Currently in my system I use the following code, to convert the dates coming in ajax.
new Date(parseInt(data.replace(/\/Date\((-?\d+)\)\//, '$1')))
Where the variable data
is a string that comes in format '/Date(1508551200000)/'
, so you can replace the variable with this string to test.
Now my problem began to appear on this date, because when I convert it with the code above gives the following result:
Fri Oct 20 2017 23:00:00 GMT-0300 (Official Time in Brazil)
But the real value is 21/10/2017, when doing a survey find that this date was the beginning of Daylight Saving Time 2017 and with that it decreased by 1hr, so I found that the dates in Daylight Saving Time are having this same problem
How can I make this conversion to q it ignore this and return me the value q I wish, without decreasing in 1hr, in case ignoring this daylight saving time conversion.
Possible duplicate of How to format date in javascript?
– Costamilam
@Guilhermecostamilam I think the problem is not with formatting, the author is having trouble with the time zone.
– Guilherme Nascimento