TimeUtil class Null safety

日期工具类

another Fairy

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Properties

now DateTime
获取当前时间-DateTime
read-only
nowMicroseconds int
获取当前时间-微妙
read-only
nowMilliseconds int
获取当前时间-毫秒
read-only

Static Methods

format(DateTime? dateTime, {DateFormat dateFormat = DateFormat.NORMAL, String? dateSeparate, String? timeSeparate}) String
日期格式化 [...]
formatByMicroseconds(int? microseconds, {DateFormat dateFormat = DateFormat.NORMAL, String? dateSeparate, String? timeSeparate, bool isUtc = false}) String
时间戳(毫秒)格式化 [...]
formatByMilliseconds(int? milliseconds, {DateFormat dateFormat = DateFormat.NORMAL, String? dateSeparate, String? timeSeparate, bool isUtc = false}) String
时间戳(毫秒)格式化 [...]
getDataTimeByMicroseconds(int microseconds, {bool isUtc = false}) DateTime
通过microseconds微秒获取时间DateTime对象
getDataTimeByMilliseconds(int milliseconds, {bool isUtc = false}) DateTime
通过milliseconds毫秒获取时间DateTime对象
getDayOfYear(DateTime dateTime) int
dateTime在今年的第几天
getDaysInMonth(int year, int month) int
获取某月的最大天数
getEndBusinessTime(int startTime, int endTime, {int ofDay = 0}) int
获取开始营业时间 [...]
getEndDateTimeMillisecondsOfToDay({int ofDay = 0}) int
获取某天的结束时间 [...]
getEndDateTimeOfToDay({int ofDay = 0}) DateTime
获取某天的结束时间 [...]
getEndDateTimeOfToMonth({int ofMonth = 0}) DateTime
获取本月的结束时间 [...]
getMilliseconds(int milliseconds) int
获取milliseconds中的时分秒毫秒之和 [...]
getStartBusinessTime(int startTime, int endTime, {int ofDay = 0}) int
获取开始营业时间 [...]
getStartDateTimeMillisecondsOfToDay({int ofDay = 0}) int
获取几天前ofDay的开始时间 [...]
getStartDateTimeOfToDay({int ofDay = 0}) DateTime
获取几天前ofDay的开始时间 [...]
getStartDateTimeOfToMonth({int ofMonth = 0}) DateTime
获取本月的开始时间 [...]
getWeekDay(DateTime dateTime) int
dateTime是星期几 [...]
getWeekDayByMilliseconds(int milliseconds, {bool isUtc = false}) int
milliseconds是星期几 [...]
isLeapYearByDateTime(DateTime dateTime) bool
判断是否为闰年 [...]
isLeapYearByYear(int year) bool
判断是否为闰年 [...]
isSameDay(DateTime? dateA, DateTime? dateB) bool
是否同日 [...]
isSameMonth(DateTime? dateA, DateTime? dateB) bool
是否同月 [...]
isSameYear(DateTime? dateA, DateTime? dateB) bool
是否同年 [...]
isToday(int? milliseconds, {bool isUtc = false}) bool
是否是今天 [...]
isYesterday(DateTime dateTime, DateTime locDateTime) bool
是否是昨天 [...]
monthDelta(DateTime startDate, DateTime endDate) int
相差多少个月 [...]
parseDataTime(String dateStr) DateTime
格式化日期转时间 [...]
parseDataTimeMicroseconds(String dateStr) int
格式化日期转时间戳-微秒
parseDataTimeMilliseconds(String dateStr) int
格式化日期转时间戳-毫秒
tryParseDataTime(String? dateStr) DateTime?
格式化日期转时间 [...]