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
-
convertToZHDateTimeString(
String time, String? timeSeparate) → String - convert To ZH DateTime String
-
dateTimeSeparate(
String time, String? dateSeparate, String? timeSeparate) → String - date Time Separate.
-
formatDate(
DateTime? dateTime, {bool? isUtc, String? format}) → String - format date by DateTime. format 转换格式(已提供常用格式 DataFormats,可以自定义格式:"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 milliseconds, {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 日期字符串
-
formatDateTime(
String time, DateFormat format, String? dateSeparate, String? timeSeparate) → String - format DateTime. time time string. format DateFormat type. dateSeparate date separate. timeSeparate time separate.
-
formatZHDateTime(
String time, DateFormat? format, String? timeSeparate) → String - format ZH DateTime. time time string. format DateFormat type. timeSeparate time separate.
-
getDateMsByTimeStr(
String dateStr) → int? - get DateMilliseconds By DateStr.
-
getDateStrByDateTime(
DateTime? dateTime, {DateFormat format = DateFormat.NORMAL, String? dateSeparate, String? timeSeparate}) → String? - get DateStr By DateTime. dateTime dateTime. format DateFormat type. dateSeparate date separate. timeSeparate time separate.
-
getDateStrByMs(
int milliseconds, {DateFormat format = DateFormat.NORMAL, String? dateSeparate, String? timeSeparate, bool isUtc = false}) → String? - get DateStr By Milliseconds. milliseconds milliseconds. format DateFormat type. dateSeparate date separate. timeSeparate time separate.
-
getDateStrByTimeStr(
String dateStr, {DateFormat format = DateFormat.NORMAL, String? dateSeparate, String? timeSeparate, bool? isUtc}) → String? - get DateStr By DateStr. dateStr date String. format DateFormat type. dateSeparate date separate. timeSeparate time separate.
-
getDateTime(
String dateStr, {bool? isUtc}) → DateTime? -
getDateTimeByMs(
int milliseconds, {bool isUtc = false}) → DateTime - get DateTime By Milliseconds.
-
getDayOfYear(
DateTime dateTime) → int - get day of year. 在今年的第几天.
-
getDayOfYearByMillis(
int millis, {bool isUtc = false}) → int - get day of year. 在今年的第几天.
-
getDaysApart(
DateTime day1, DateTime day2, {int correction = 1}) → int -
返回相隔天数,
Correction
改正数 -
getDaysInMouth(
{DateTime? dateTime, int? year, int? month}) → int - 返回当前月份的自然月天数
-
getNowDateMs(
) → int - get Now Date Milliseconds.
-
getNowDateStr(
) → String? - get Now Date Str.(yyyy-MM-dd)
-
getNowDateTimeStr(
) → String? - get Now DateTime Str.(yyyy-MM-dd HH:mm:ss)
-
getSpringEquinoxData(
DateTime dt) → DateTime -
getWeekDay(
DateTime? dateTime) → String? - get WeekDay.
-
getWeekDayByMs(
int milliseconds, {bool isUtc = false}) → String? - get WeekDay By Milliseconds.
-
getYMDWeekDay(
DateTime time) → String - 返回 年月日星期
-
getZHWeekDay(
DateTime? dateTime) → String? - get ZH WeekDay.
-
getZHWeekDayByMs(
int milliseconds, {bool isUtc = false}) → String? - get ZH WeekDay By Milliseconds.
-
getZHYMDWeekDay(
DateTime time) → String - 返回 年月日星期
-
isLeapYearByDateTime(
DateTime dateTime) → bool - Return whether it is leap year.
-
isLeapYearByYear(
int year) → bool - Return whether it is leap year.
-
isQinMing(
DateTime dt) → bool -
isSameDay(
DateTime? day1, DateTime? day2) → bool - 是否是同一天
-
isToday(
int? milliseconds, {bool isUtc = false}) → bool - is today. 是否是当天.
-
isWeek(
int? milliseconds, {bool isUtc = false}) → bool - is Week. 是否是本周.
-
isYesterday(
DateTime dateTime, DateTime locDateTime) → bool - is yesterday by dateTime. 是否是昨天.
-
isYesterdayByMillis(
int millis, int locMillis) → bool - is yesterday by millis. 是否是昨天.
-
isZHFormat(
DateFormat format) → bool - is format to ZH DateTime String
-
yearIsEqual(
DateTime dateTime, DateTime locDateTime) → bool - year is equal. 是否同年.
-
yearIsEqualByMillis(
int millis, int locMillis) → bool - year is equal. 是否同年.