DateTimeExtensions extension

Provides extended methods for DateTime.

DateTime用の拡張メソッドを提供します。

on

Properties

weekNumber int
Gets the ISO 8601 week number from DateTime.
no setter

Methods

age([DateTime? today]) DateDuration
Returns the age at today (or current time) for the date.
dateToNextBirthday([DateTime? target]) DateDuration
Returns the period until the next year date at target (or current time) for a date.
E() String
Parse from DateTime to String corresponding to an Intl DateFormat.
format(String format) String
Parses DateTime to String by passing format corresponding to the Intl DateFormat.
HHmm() String
Parse from DateTime to String corresponding to an Intl DateFormat.
HHmmss() String
Parse from DateTime to String corresponding to an Intl DateFormat.
isThisDay([DateTime? dateTime]) bool
Returns true if the date is the same as a specific dateTime or the current time.
isThisHour([DateTime? dateTime]) bool
Returns true if the time is the same as a specific dateTime or the current time.
isThisMinute([DateTime? dateTime]) bool
Returns true if the minute is the same as a specific dateTime or the current time.
isThisMonth([DateTime? dateTime]) bool
Returns true if the month is the same as a specific dateTime or the current time.
isThisSecond([DateTime? dateTime]) bool
Returns true if the second is the same as a specific dateTime or the current time.
isThisYear([DateTime? dateTime]) bool
Returns true if the year is the same as a specific dateTime or the current time.
isToday([DateTime? dateTime]) bool
toDate() DateTime
Create a new DateTime by extracting only the year and month from DateTime.
toDateID() String
Converts from DateTime to a String of the form 20221223.
toDateTimeID() String
Converts from DateTime to a String of the form 20221223102331.
toUnUtc() DateTime
Treats DateTime, which is not defined as UTC due to parsing, as UTC and converts it to local time.
yyyyMM() String
Parse from DateTime to String corresponding to an Intl DateFormat.
yyyyMMdd() String
Parse from DateTime to String corresponding to an Intl DateFormat.
yyyyMMddHHmm() String
Parse from DateTime to String corresponding to an Intl DateFormat.
yyyyMMddHHmmss() String
Parse from DateTime to String corresponding to an Intl DateFormat.