TimeFormat class

A utility class containing common, fixed date and time format strings as static constants.

These constants are useful for consistent formatting across an application where a specific, non-localized format is required (example: API communication, logging, database storage). Access formats directly via the class name, example: TimeFormat.yyyyMMdd.

Example usage with my package:

Time time = Time.now();
final formatted = time.format(TimeFormat.yyyyMMdd);

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

Constants

dayFullName → const String
example: Tuesday (Full Day Name)
dayShortName → const String
example: Tue (Short Day Name)
ddMMMMyyyy → const String
example: 08 April 2025 (Full Month, 4-digit year)
ddMMMyy → const String
example: 08 Apr 25 (Short Month, 2-digit year) - Use yyyy in string if 4-digit year needed.
ddMMyyyyDash → const String
example: 08-04-2025 (European Format)
ddMMyyyyHHmmss → const String
example: 08/04/2025 13:52:05 (EU Date, 24h Time)
ddMMyyyySlash → const String
example: 08/04/2025 (European Format)
EEEddMMMyyyyHHmmss → const String
example: Tue, 08 Apr 2025 13:52:05 (Readable, 24h Time)
EEEddMMMyyyyhhmmssa → const String
example: Tue, 08 Apr 2025 01:52:05 PM (Readable, 12h Time)
EEEEMMMMddyyyy → const String
example: Tuesday, April 08, 2025 (Full Day/Month, 4-digit year)
EEEMMMddyyyy → const String
example: Tue, Apr 08, 2025 (Short Day/Month, 4-digit year)
HHmm → const String
example: 13:52 (24-hour, no seconds)
hhmma → const String
example: 01:52 PM (12-hour, no seconds, AM/PM)
HHmmss → const String
example: 13:52:05 (24-hour, seconds)
hhmmssa → const String
example: 01:52:05 PM (12-hour, seconds, AM/PM)
iso8601Millis → const String
example: 2025-04-08T13:52:05.123 (Local, Millis)
iso8601MillisTimezone → const String
example: 2025-04-08T13:52:05.123+0600 (Local, Millis, Timezone Offset)
iso8601UTC → const String
example: 2025-04-08T13:52:05Z (UTC)
MdSlash → const String
example: 4/8 (Short Month/Day, no leading zeros)
MMddyyyyHHmmss → const String
example: 04/08/2025 13:52:05 (US Date, 24h Time)
MMddyyyySlash → const String
example: 04/08/2025 (US Format)
MMMd → const String
example: Apr 8 (Short Month, Day)
monthFullName → const String
example: April (Full Month Name)
monthShortName → const String
example: Apr (Short Month Name)
yearFull → const String
example: 2025 (4-digit Year)
yearShort → const String
example: 25 (2-digit Year)
yyyyMMdd → const String
example: 2025-04-08 (ISO Date - Common for Database)
yyyyMMddHHmmss → const String
example: 2025-04-08 13:52:05 (ISO Date, 24h Time - Common for Logs/DBs)
yyyyMMddhhmmssa → const String
example: 2025-04-08 01:52:05 PM (ISO Date, 12h Time)