DateTimeExtension extension

on

Properties

dayIndexOfYear int
处在当年的第几天
no setter
daysOfYear int
当年的总天数
no setter
firstDayInYear DateTime
当年最早的时间
no setter
isLeapYearByYear bool
是否是闰年
no setter
lastDayInYear DateTime
当年最后的时间
no setter
timeZone double
获取时区
no setter

Methods

copyWith({int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond}) DateTime
dayIndexOfWeek([int firstWeekDay = 1]) int
获取当前日期处在当前周的第几天
daysInMonth([int firstDay = 1]) int
当月总天数
firstDayInMonth([int firstDay = 1]) DateTime
当月第一天
firstDayInNextMonth([int firstDay = 1]) DateTime
下月第一天
firstDayInNextWeek([int firstWeekDay = 1]) DateTime
下周第一天
firstDayInPreviousMonth([int firstDay = 1]) DateTime
上月第一天
firstDayInPreviousWeek([int firstWeekDay = 1]) DateTime
上周第一天
firstDayInWeek([int firstWeekDay = 1]) DateTime
本周第一天
firstWeekFirstDayInYear([int firstWeekDay = 1]) DateTime
当年第一周的第一天。 算法:获取1月4号所在周的第一天
firstWeekLastDayInYear([int firstWeekDay = 1]) DateTime
当年第一周的最后一天。 算法:获取1月4号所在的周
getDateStr({String format = 'yyyy-MM-dd', MiniLocalType localType = MiniLocalType.zh}) String
获取日期显示字符串 yyyy-MM-dd EEEE/EE
getDateTimeStr({String format = 'yyyy-MM-dd HH:mm:ss', MiniLocalType localType = MiniLocalType.zh}) String
获取时间字符串 yyyy-MM-dd HH:mm:ss.SSS EEEE/EE
getFirstWeekdaysInYear([int firstWeekDay = 1]) List<DateTime>
当年第一周所有日期
getWeekdays([int firstWeekDay = 1]) List<DateTime>
本周所有日期
getWeekShortStr([MiniLocalType localType = MiniLocalType.zh]) String
getWeekStr([MiniLocalType localType = MiniLocalType.zh]) String
isToday([DateTime? now]) bool
是否是今天 now - 当前时间,默认DateTime.now()
isYesterday([DateTime? now]) bool
是否是昨天 now - 当前时间,默认DateTime.now()
lastDayInMonth([int firstDay = 1]) DateTime
当月最后一天
lastDayInNextMonth([int firstDay = 1]) DateTime
下月最后一天
lastDayInNextWeek([int firstWeekDay = 1]) DateTime
下周最后一天
lastDayInPreviousMonth([int firstDay = 1]) DateTime
上月最后一天
lastDayInPreviousWeek([int firstWeekDay = 1]) DateTime
上周最后一天
lastDayInWeek([int firstWeekDay = 1]) DateTime
本周最后一天
weekIndexOfYear([int firstWeekDay = 1]) int
获取当前时间是一年中的第几周
0-上一年的最后一周
-1-下一年的第一周

Operators

operator -(DateTime other) int
operator <(DateTime other) bool
operator <=(DateTime other) bool
operator >(DateTime other) bool
operator >=(DateTime other) bool