DateUtil class

Date Util.

Constructors

DateUtil()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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 Methods

formatDate(DateTime? dateTime, {String? format}) → String
format date by DateTime. format 转换格式(已提供常用格式 DateFormats,可以自定义格式:'yyyy/MM/dd HH:mm:ss') 格式要求 year -> yyyy/yy month -> MM/M day -> dd/d hour -> HH/H minute -> mm/m second -> ss/s
formatDateMs(int ms, {bool isUtc = false, String? format}) → String
format date by milliseconds. milliseconds 日期毫秒
formatDateStr(String dateStr, {bool? isUtc, String? format}) → String
format date by date str. dateStr 日期字符串
getDateMsByTimeStr(String dateStr, {bool? isUtc}) → int?
get DateMilliseconds By DateStr.
getDateTime(String dateStr, {bool? isUtc}) → DateTime?
get DateTime By DateStr.
getDateTimeByMs(int ms, {bool isUtc = false}) → DateTime
get DateTime By Milliseconds.
getDayOfYear(DateTime dateTime) → int
get day of year. 在今年的第几天.
getDayOfYearByMs(int ms, {bool isUtc = false}) → int
get day of year. 在今年的第几天.
getNowDateMs() → int
get Now Date Milliseconds.
getNowDateStr() → String
get Now Date Str.(yyyy-MM-dd HH:mm:ss)
getWeekday(DateTime? dateTime, {String languageCode = 'en', bool short = false}) → String
get WeekDay. dateTime isUtc languageCode zh or en short
getWeekdayByMs(int milliseconds, {bool isUtc = false, String languageCode = 'en', bool short = false}) → String
get WeekDay By Milliseconds.
isLeapYear(DateTime dateTime) → bool
Return whether it is leap year. 是否是闰年
isLeapYearByYear(int year) → bool
Return whether it is leap year. 是否是闰年
isToday(int? milliseconds, {bool isUtc = false, int? locMs}) → bool
is today. 是否是当天.
isWeek(int? ms, {bool isUtc = false, int? locMs}) → bool
is Week. 是否是本周.
isYesterday(DateTime dateTime, DateTime locDateTime) → bool
is yesterday by dateTime. 是否是昨天.
isYesterdayByMs(int ms, int locMs) → bool
is yesterday by millis. 是否是昨天.
yearIsEqual(DateTime dateTime, DateTime locDateTime) → bool
year is equal. 是否同年.
yearIsEqualByMs(int ms, int locMs) → bool
year is equal. 是否同年.