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 now
no 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 hour
no setter
endOfMinute DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the end of the minute
no 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 quarter
no 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 Friday
no setter
isFuture bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is in the future
no setter
isMonday bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is Monday
no 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 past
no setter
isSaturday bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is Saturday
no setter
isSunday bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is Sunday
no setter
isThisMonth bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is in the current month
no setter
isThisWeek bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is in the current week
no setter
isThisYear bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is in the current year
no setter
isThursday bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is Thursday
no setter
isToday bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is today
no setter
isTomorrow bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is tomorrow
no setter
isTuesday bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is Tuesday
no setter
isWednesday bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is Wednesday
no 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 yesterday
no 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 day
no setter
roundToHour DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Rounds this date to the nearest hour
no 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 hour
no setter
startOfMinute DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the start of the minute
no 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 quarter
no 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 time
no setter
toUtc DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Converts this date to UTC
no setter
weekNumber int

Available on DateTime, provided by the DateTimeExtensions extension

Gets the ISO week number
no setter

Methods

addBusinessDays(int days) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Adds days business days (skips weekends)
addMonths(int months) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Adds months months (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 since other date
businessDaysUntil(DateTime other) int

Available on DateTime, provided by the DateTimeExtensions extension

Gets the number of business days until other date
clampBetween(DateTime min, DateTime max) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Clamps this date between min and max
daysSince(DateTime other) int

Available on DateTime, provided by the DateTimeExtensions extension

Gets the number of days since other date
daysUntil(DateTime other) int

Available on DateTime, provided by the DateTimeExtensions extension

Gets the number of days until other date
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 between start and end (inclusive)
isSameDayAs(DateTime other) bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks if this date is the same day as other
isSameMonthAs(DateTime other) bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks if this date is the same month as other
isSameWeekAs(DateTime other) bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks if this date is the same week as other
isSameYearAs(DateTime other) bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks if this date is the same year as other
subtractBusinessDays(int days) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Subtracts days business days (skips weekends)
subtractMonths(int months) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Subtracts months months