DateTime in UTC not converting to Local

Flutter gave us the easiest way to convert it.
You just need to pass utc: true while parsing your date.

var dateTime = DateFormat("yyyy-MM-dd HH:mm:ss").parse(dateUtc, true);
var dateLocal = dateTime.toLocal();

Input:

Assume my TimeZone : +05:30

UTC Date -> 2020-02-12 23:57:02.000

Output:

Local Date -> 2020-02-12 18:27:02.019660

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)