XDateUtil class

Date Util.

Constructors

XDateUtil()

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 = DateFormats.full}) String
格式化日期 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 = DateFormats.full}) String
格式化 时间戳 显示日期 milliseconds 日期毫秒
formatDateStr(String dateStr, {bool? isUtc, String format = DateFormats.full}) String?
格式化 日期 by 字符串 dateStr 日期字符串
formatTime12(DateTime dateTime, {String format = 'HH:mm'}) String
显示 12小时制时间
getDateMsByTimeStr(String dateStr) int?
通过字符串获取 毫秒
getDateTime(String dateStr, {bool? isUtc}) DateTime?
通过字符串获取 DateTime
getDateTimeByMs(int ms, {bool isUtc = false}) DateTime
通过 毫秒 获取 DateTime
getDayOfYear(DateTime dateTime) int
在今年的第几天.
getDayOfYearByMs(int ms, {bool isUtc = false}) int
在今年的第几天.
getNowDateMs() int
获取当前时间戳
getNowDateStr({String format = DateFormats.full}) String
获取当前时间字符串.(yyyy-MM-dd HH:mm:ss)
getWeekday(DateTime dateTime, {String languageCode = 'zh', bool short = false}) String
获取日期
getWeekdayByMs(int milliseconds, {bool isUtc = false, String languageCode = 'zh', bool short = false}) String
get WeekDay By Milliseconds.
isLeapYear(DateTime dateTime) bool
是否是闰年
isLeapYearByYear(int year) bool
是否是闰年
isToday(int milliseconds, {bool isUtc = false, int? locMs}) bool
是否是当天.
isWeek(int ms, {bool isUtc = false, int? locMs}) bool
是否是本周.
isYesterday(DateTime dateTime, DateTime locDateTime) bool
是否是昨天.
isYesterdayByMs(int ms, int locMs) bool
是否是昨天.
secToTime(int mseconds) String
int 转 显示时间
yearIsEqual(DateTime dateTime, DateTime locDateTime) bool
是否同年.
yearIsEqualByMs(int ms, int locMs) bool
是否同年.

Constants

MONTH_DAY → const Map<int, int>
month->days.