Home > Enterprise >  Date time format : what is the format called?
Date time format : what is the format called?

Time:01-28

Want to know what type of Date format is this : 2022-08-12T01:47:24.856316 , 2022-09-15T08:32:38.490Z
And how do i implement the current time to this format.

CodePudding user response:

The format is known as ISO 8601, and you can parse and format it like this:

void main() {
  print(DateTime.parse('2022-08-12T01:47:24.856316'));
  print(DateTime.parse('2022-09-15T08:32:38.490Z'));
  print(DateTime.now().toUtc().toIso8601String());
}

Output:

2022-08-12 01:47:24.856
2022-09-15 08:32:38.490Z
2023-01-28T07:28:29.865Z
  • Related