Dayfl class

Constructors

Dayfl([dynamic datetime, String formatStr = ''])
datetime 支持传入格式 Dayfl | String | int | DateTime

Properties

dateTime DateTime?
获取时间 返回 DateTime
no setter
day int
获取日 int
getter/setter pair
daysInMonth int?
获取当前日期月份天数
no setter
hashCode int
The hash code for this object.
no setterinherited
hour int
获取小时 int
getter/setter pair
isLeapYear bool?
是否是闰年
no setter
isUtc bool?
isUtc
no setter
minute int
获取分钟 int
getter/setter pair
month int
获取月 int
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
second int
获取秒 int
getter/setter pair
setLocale String
设置语言
no getter
valueOf int?
获取时间戳 单位毫秒
no setter
year int
获取年 int
getter/setter pair

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
是否在 ab 之间(不包含端点)
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 时间戳

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

addLocale(Locale arg) bool
添加语言
addMatchers(String key, MatchersFunc matchersFunc) → void
新增格式化参数
delMatchers(String key) → void
删除自定添加的格式化参数