DateTimeExtensions extension
Extension methods on DateTime for date/time operations
- on
Properties
- age → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Calculates age from this date (birthdate) to nowno setter - endOfDay → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the end of the day (23:59:59.999)no setter - endOfHour → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the end of the hourno setter - endOfMinute → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the end of the minuteno setter - endOfMonth → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the end of the month (last day 23:59:59)no setter - endOfQuarter → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the end of the quarterno setter - endOfWeek → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the end of the week (Sunday 23:59:59)no setter - endOfYear → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the end of the year (December 31st 23:59:59)no setter - isAfternoon → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is in the afternoon (12:00-17:00)no setter - isEvening → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is in the evening (17:00-21:00)no setter - isFriday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is Fridayno setter - isFuture → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is in the futureno setter - isMonday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is Mondayno setter - isMorning → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is in the morning (before 12:00)no setter - isNight → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is at night (after 21:00)no setter - isPast → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is in the pastno setter - isSaturday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is Saturdayno setter - isSunday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is Sundayno setter - isThisMonth → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is in the current monthno setter - isThisWeek → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is in the current weekno setter - isThisYear → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is in the current yearno setter - isThursday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is Thursdayno setter - isToday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is todayno setter - isTomorrow → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is tomorrowno setter - isTuesday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is Tuesdayno setter - isWednesday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is Wednesdayno setter - isWeekday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is a weekday (Monday-Friday)no setter - isWeekend → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is a weekend (Saturday or Sunday)no setter - isYesterday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is yesterdayno setter - quarter → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Gets the quarter number (1-4)no setter - roundToDay → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Rounds this date to the nearest dayno setter - roundToHour → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Rounds this date to the nearest hourno setter - startOfDay → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the start of the day (00:00:00.000)no setter - startOfHour → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the start of the hourno setter - startOfMinute → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the start of the minuteno setter - startOfMonth → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the start of the month (first day 00:00:00)no setter - startOfQuarter → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the start of the quarterno setter - startOfWeek → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the start of the week (Monday 00:00:00)no setter - startOfYear → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the start of the year (January 1st 00:00:00)no setter - timezoneName → String
-
Available on DateTime, provided by the DateTimeExtensions extension
Gets the timezone name (e.g., "PST")no setter - timezoneOffset → String
-
Available on DateTime, provided by the DateTimeExtensions extension
Gets the timezone offset string (e.g., "+05:30")no setter - toLocal → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Converts this date to local timeno setter - toUtc → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Converts this date to UTCno setter - weekNumber → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Gets the ISO week numberno setter
Methods
-
addBusinessDays(
int days) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Addsdaysbusiness days (skips weekends) -
addMonths(
int months) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Addsmonthsmonths (handles edge cases like Jan 31 + 1 month) -
businessDaysSince(
DateTime other) → int -
Available on DateTime, provided by the DateTimeExtensions extension
Gets the number of business days sinceotherdate -
businessDaysUntil(
DateTime other) → int -
Available on DateTime, provided by the DateTimeExtensions extension
Gets the number of business days untilotherdate -
clampBetween(
DateTime min, DateTime max) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Clamps this date betweenminandmax -
daysSince(
DateTime other) → int -
Available on DateTime, provided by the DateTimeExtensions extension
Gets the number of days sinceotherdate -
daysUntil(
DateTime other) → int -
Available on DateTime, provided by the DateTimeExtensions extension
Gets the number of days untilotherdate -
formatCustom(
String pattern, [String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats the date using a custom pattern -
formatDateTimeLong(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats date and time together in long format -
formatDateTimeMedium(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats date and time together in medium format -
formatDateTimeShort(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats date and time together in short format -
formatForFileName(
) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats the date for use in filenames -
formatFull(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats the date in full format (e.g., "Monday, December 1, 2025") -
formatIso8601(
) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats the date in ISO 8601 format -
formatLong(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats the date in long format (e.g., "December 1, 2025") -
formatMedium(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats the date in medium format (e.g., "Dec 1, 2025") -
formatShort(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats the date in short format (e.g., "12/1/2025") -
formatTime12Hour(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats the time in 12-hour format (e.g., "2:30 PM") -
formatTime12HourWithSeconds(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats the time in 12-hour format with seconds -
formatTime24Hour(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats the time in 24-hour format (e.g., "14:30") -
formatTime24HourWithSeconds(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Formats the time in 24-hour format with seconds -
getRelativeTime(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Gets relative time string (e.g., "2 hours ago", "in 3 days") -
getRelativeTimeShort(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Gets short relative time string (e.g., "2h", "3d") -
getSmartFormat(
[String locale = 'en_US']) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Gets smart formatted string (context-aware) -
isBetween(
DateTime start, DateTime end) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Checks if this date is betweenstartandend(inclusive) -
isSameDayAs(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Checks if this date is the same day asother -
isSameMonthAs(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Checks if this date is the same month asother -
isSameWeekAs(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Checks if this date is the same week asother -
isSameYearAs(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Checks if this date is the same year asother -
subtractBusinessDays(
int days) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Subtractsdaysbusiness days (skips weekends) -
subtractMonths(
int months) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Subtractsmonthsmonths