DateHelper class
Provides utility methods related to date and time.
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
- currentDay → int
-
Gets the current day of the month.
no setter
- currentMonth → int
-
Gets the current month.
no setter
- currentMS → int
-
Gets the current time in milliseconds since epoch.
no setter
- currentYear → int
-
Gets the current year.
no setter
- weekday → int
-
no setter
Static Methods
-
isToday(
int? ms) → bool - Checks if the given milliseconds since epoch represents today.
-
isTomorrow(
int? ms) → bool - Checks if the given milliseconds since epoch represents tomorrow.
-
isWeekday(
int day) → bool -
isYesterday(
int? ms) → bool - Checks if the given milliseconds since epoch represents yesterday.
-
range(
{required DateTime start, required DateTime end, Duration difference = const Duration(days: 1)}) → List< DateTime> -
realtime(
int? ms) → String - Converts milliseconds since epoch to a human-readable relative time string.
-
toDate(
int ms, {String? format, String? local, TimeFormats? timeFormat, DateFormats dateFormat = DateFormats.dateDMCY, String? separator}) → String - Converts milliseconds since epoch to a formatted date string.
-
toDateFromUTC(
int year, int month, int day, [TimeFormats timeFormat = TimeFormats.none, DateFormats dateFormat = DateFormats.none, String? pattern, String separator = "", String? local]) → String - Converts UTC components to a formatted date string.
-
toDay(
int timeMills) → int - Converts milliseconds since epoch to the day of the month.
-
toMonth(
int timeMills) → int - Converts milliseconds since epoch to the month.
-
toMSFromSource(
String? source) → int - Converts a date string to milliseconds since epoch.
-
toMSFromUTC(
int year, [int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0]) → int - Converts UTC components to milliseconds since epoch.
-
toRealtime(
int? ms, {String? format, String? local, TimeFormats timeFormat = TimeFormats.timeHMa, DateFormats dateFormat = DateFormats.dateDMCY, String separator = " at ", RealtimeTextFormats? formats, RealtimeOptions? options}) → String - Converts milliseconds since epoch to a customizable relative time string.
-
toRecentWeekday(
int weekday, [DateTime? initial]) → DateTime -
toYear(
int timeMills) → int - Converts milliseconds since epoch to the year.