SPDateUtils class

DateTime的工具库

Constructors

SPDateUtils()

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 Properties

lastMonth DateTimeRange
获得上月的时间间隔
no setter
lastMonthEnd DateTime
上月结束时刻,是本月的起始时刻
no setter
lastMonthStart DateTime
上个月起始时刻,上月1日0时
no setter
thisMonth DateTimeRange
获得本月的时间间隔(本月时间)
no setter
thisMonthEnd DateTime
本月的结束时刻,也是下个月的起始时刻
no setter
thisMonthStart DateTime
本月起始时刻,本月1日0时,也是上月结束时刻
no setter
thisYear DateTimeRange
获得今年的时间间隔
no setter
thisYearStart DateTime
今年1月1日
no setter
today DateTimeRange
获得今天的时间间隔
no setter
todayEnd DateTime
今日24时
no setter
todayStart DateTime
今天0时
no setter
tomorrow DateTimeRange
昨天
no setter
yesterday DateTimeRange
获得昨天的时间间隔
no setter

Static Methods

dateFormat(String value, String inFormatStr, String outFormatStr) String
date format @param value 输入日期 @param inFormatStr 输入日期格式化 @param outFormatStr 输出日期格式化
dateFormatTDate(String outFormatStr, String? value) String
yyyy-MM-ddTHH:mm:ss.SSSSSS
dateTimeNowIso() String
dateTimeNowMilli() int
defaultFormatDate(String? time) String
格式化时间:日期 时分秒
format(DateTime? dt, [String formatString = 'yyyy-MM-dd HH:mm:ss']) String?
格式化日期时间
formatChatListTime(String? time) String?
格式化聊天列表页的时间
formatFromString(String formattedString, [String formatString = 'yyyy-MM-dd HH:mm:ss']) String?
通过字符串获得格式化的字符串
formatWithWeek(String? time) String
格式化时间:日期 星期 时分秒
getRelativeFormat(DateTime? dt, {bool withTime = false}) String
获得相对时间
rangeDay(int n) DateTimeRange
n天内

Constants

FORMAT_MMDD_HHMM → const String
FORMAT_T_YYYYMMDD → const String
FORMAT_T_YYYYMMDD_SSSSSS → const String
FORMAT_YYYY_MM_DD → const String
常用日期格式
FORMAT_YYYYMMDD_HHMMSS → const String