Dayfl class
Constructors
-
Dayfl([dynamic datetime, String formatStr = ''])
-
datetime 支持传入格式 Dayfl | String | int | DateTime
Methods
-
add(DateLocationEnum type, int num)
→ Dayfl
-
添加日期
-
compareTo(dynamic date)
→ int
-
和DateTime 的 compareTo 方法一样
-
difference(dynamic date)
→ Duration
-
时间差 两个时间相差 小时数
-
diffIn(dynamic date, DateLocationEnum unit)
→ int
-
计算两个时间的差值,支持自定义单位
-
endOf(DateLocationEnum type)
→ Dayfl
-
Manipulate the Dayfl object to the end of a unit of time.
-
format([String formatStr = Location.defaultFormatStr, String locale = '', dynamic dayFormat = false])
→ String
-
格式化
-
get(DateLocationEnum unit)
→ int
-
通用 getter,按单位获取值
-
getLocale([String name = ''])
→ Locale
-
获取当前使用语言包
-
getWeek([String locale = ''])
→ Map<String, dynamic>
-
获取week
-
isAfter(dynamic date)
→ bool
-
之后
-
isBefore(dynamic date)
→ bool
-
之前
-
isBetween(dynamic a, dynamic b, {bool inclusive = false})
→ bool
-
是否在
a 和 b 之间(不包含端点)
-
isSame(Dayfl dayfl, [DateLocationEnum type = DateLocationEnum.millisecondsSinceEpoch])
→ bool
-
判断日期是否相同
-
isSameOrAfter(dynamic date, [DateLocationEnum type = DateLocationEnum.millisecondsSinceEpoch])
→ bool
-
是否在
date 之后或相同
-
isSameOrBefore(dynamic date, [DateLocationEnum type = DateLocationEnum.millisecondsSinceEpoch])
→ bool
-
是否在
date 之前或相同
-
isValid()
→ bool
-
日期是否有效
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
set(DateLocationEnum unit, int value)
→ Dayfl
-
通用 setter,按单位设置值
-
setDay(int value)
→ Dayfl
-
设置日期(方法调用形式,支持链式调用)
value 日期值,范围1-31(根据月份自动调整)
返回当前Dayfl对象以支持链式调用
-
setHour(int value)
→ Dayfl
-
设置小时(方法调用形式,支持链式调用)
value 小时值,范围0-23
返回当前Dayfl对象以支持链式调用
-
setMinute(int value)
→ Dayfl
-
设置分钟(方法调用形式,支持链式调用)
value 分钟值,范围0-59
返回当前Dayfl对象以支持链式调用
-
setMonth(int value)
→ Dayfl
-
设置月份(方法调用形式,支持链式调用)
value 月份值,范围1-12
返回当前Dayfl对象以支持链式调用
-
setSecond(int value)
→ Dayfl
-
设置秒(方法调用形式,支持链式调用)
value 秒值,范围0-59
返回当前Dayfl对象以支持链式调用
-
setYear(int value)
→ Dayfl
-
设置年份(方法调用形式,支持链式调用)
value 年份值,范围1-9999
返回当前Dayfl对象以支持链式调用
-
startOf(DateLocationEnum type)
→ Dayfl
-
Manipulate the Dayfl object to the start of a unit of time.
-
subtract(DateLocationEnum type, int num)
→ Dayfl
-
减去日期
-
toArray()
→ List<int>
-
转换成数组
dayfl('2019-01-25').toArray() //
2019, 0, 25, 0, 0, 0, 0
-
toISOString()
→ String?
-
ISO 8601 字符串
-
toString()
→ String
-
A string representation of this object.
inherited
-
unix()
→ int?
-
秒级 Unix 时间戳