Flutter DateTime date acquisition & conversion between string and date

Flutter DateTime date acquisition & conversion between string and date


DateTime can be used to get and set the date and time, a class commonly used in development.

The main properties and methods of DateTime

The main methods and properties of DateTime are as follows:

Insert picture description here

Convert between string and date

String–>DateTime

DateTime.parse(String);

DateTime -->formatString

formatDate(DateTime(2020, 12, 23) ,['yyyy', '-', 'mm', '-', 'dd']);

formatDate(DateTime(2020, 12, 23, 20, 40, 10), [‘HH’, ':', ‘nn’, ':', ‘ss’])

The date formatting library: date_format is used here. For details, please refer to the previous article: "Flutter Date Formatting Library date_format"


**PS: For more exciting content, please check --> "Flutter Development"
**PS: For more exciting content, please check --> "Flutter Development"
**PS: For more exciting content, please check --> "Flutter Development"

Guess you like

Origin blog.csdn.net/u011578734/article/details/111871833