-1
print(json["end"] + " date before parsing");
print(DateTime.parse(json["end"]).toString() + " date after parsing");

Output

I/flutter ( 7101): 2022-07-19T05:00:00+05:30 date before parsing
I/flutter ( 7101): 2022-07-18 23:30:00.000Z date after parsing

As you can see, the date before parsing is 19-07-2022 but after parsing it, the date I am getting is 18-07-2022. Why is this happening, and how to solve this?

Binary_Beast
  • 101
  • 7

1 Answers1

1

From your response, you can check you're getting the time (current Date&Time of your system + +5:30) so try to use .toUtc() or something because your time is 5 hr 30 min less that's why you're getting one day before.

Hamed
  • 5,867
  • 4
  • 32
  • 56