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. 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.
formatDateStr(String dateStr, {bool? isUtc, String? format}) String
format date by date str.
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.