CustomTimeFunctions class

Custom time formatter

Constructors

CustomTimeFunctions()

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 Methods

convertTimeZone() String
Returns the current device's time zone offset as a string. Note: This might not be a reliable way to get a timezone name.
convertToCurrentTimeZone(DateTime dateTime, String fromTimeZone, String toTimeZone) DateTime
(Incomplete/Incorrect Implementation)
customFormatting(DateTime time, String format) String
EEE means English short weekday name MMM means English short month name dd means two digit day yyyy means four digit year d means single digit day mm means single digit month y means single digit year ' ' will add space - will add - like dd-MM
formatDateddmmyy(DateTime date) String
Formats a DateTime into 'dd-MM-yyyy' format and converts to uppercase.
formatDateddmmyyhhmmss(DateTime date) String
Formats a DateTime into 'ddMMyyhhmmss' format and converts to uppercase.
formatDateInDateMonthNameyear(DateTime time) String
Formats a DateTime into 'MMM dd, yyyy' format. Example: 'Nov 29, 2023'.
formatDateIndayDateMonthAtTime(DateTime time) String
Formats a DateTime into 'EEE, dd MMM, yyyy, hh:mma' format. Example: 'Wed, 29 Nov, 2023, 05:30PM'.
formatDateInDayDateMonthAtTimeNew(DateTime time) String
Formats a DateTime object into a string 'EEE MMM dd, yyyy'. Example: 'Wed, Nov 29, 2023'.
formatDateInHHMMDD(DateTime time) String
Formats a DateTime into 'hh:mma, dd MMM, yyyy' format. Example: '05:30PM, 29 Nov, 2023'.
formatDateMonthAndDate(DateTime date) String
Formats a DateTime into 'MMM d' format and converts to uppercase.
formatDateMonthAndYear(DateTime? date) String
Formats a nullable DateTime into 'MMM d, y' format and converts to uppercase. Returns an empty string if the date is null or on error.
formatDayDateMonthAndYear(DateTime? date) String
Formats a nullable DateTime into 'EEE, MMM d, y' format and converts to uppercase. Returns an empty string if the date is null or on error.
formatSeconds(int seconds) String
Formats the given number of seconds into a 'mm:ss' string format.
formatTime(TimeOfDay time) String
Formats a TimeOfDay object into a 12-hour 'hh:mm' string format.
formatTimeForChat(TimeOfDay time) String
Formats a TimeOfDay object into a 'HH:mm' 24-hour format string.
formatTimeIn12Hrs(TimeOfDay time) String
Formats a TimeOfDay into a 12-hour string with AM/PM. Example: '05:30PM'.
getAmPm(TimeOfDay time) String
Returns 'AM' or 'PM' based on the period of the given TimeOfDay.
getDetailedDifference(DateTime start, DateTime end) String
Calculates the difference between two DateTime objects and returns it in a "days:hours:minutes" format.
getMonth(int day) String
Returns the three-letter abbreviation for a month, given its number (1 for January, 12 for December). Returns 'Sunnn $day' for invalid input.
getTimeFromDate(DateTime? date, {String timeFormat = "hh:mm a'"}) String
Extracts and formats the time from a nullable DateTime object.
getTimeLeft({required DateTime fromDateTime, required DateTime toDateTime}) String
Calculates the time remaining between two DateTime objects.
getTimeList({int durationInMinutes = 30, int startingHour = 6, int endingHour = 23, int startingMinute = 0}) List<TimeOfDay>
Generates a list of TimeOfDay objects at a specified interval.
getTimeZoneOffset(String timeZone) int
(Incomplete/Incorrect Implementation)
getWeekDay(int day) String
Returns the three-letter abbreviation for a day of the week, given its number (1 for Monday, 7 for Sunday). Returns 'Sunnn $day' for invalid input.
timeAgo(DateTime d) String
Calculates the time difference between now and a given DateTime d and returns a human-readable string like "just now", "5 mins ago", "1 day ago", etc.