0

Why print error, date -1 day my date is 2020-03-16, but print 2020-03-15?

This my code:

let dt = new Date('2020-03-16'); let dt_new = new Intl.DateTimeFormat('pt-BR').format(dt); console.log(dt_new);

3
  • Can you clarify? I see 16/03/2020 printed out. Commented Apr 1, 2020 at 11:19
  • 2
    Only if you're in a timezone with a negative offset. The date is taken as UTC, then the offset is applied to convert it to local time. Commented Apr 1, 2020 at 11:20
  • I'm Brazil, see 15/03/2020, where do i put UTC correct? Commented Apr 1, 2020 at 11:22

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.