instant library

A library devoted to the conversion and simplification of dates and times in Dart.

Classes

InstantStopwatch
An alternative to the built in Stopwatch class. [...]

Properties

curDateInWords → String
Returns the local current date in words (ex. 'January 19, 2019').
read-only
curDayAsInt → int
Returns current day as an int (1 ... 31).
read-only
curDayAsString → String
Returns local current day as a # String formatted DD (ex. '04').
read-only
curHrAsInt → int
Returns local current hour as an int (1...24).
read-only
curHrAsString → String
Returns local current DateTime's hour as a # String formatted HH (ex. '14').
read-only
curMillisecAsInt → int
Returns current millisecond as an int (0...999).
read-only
curMillisecAsString → String
Returns local current DateTime's millisecond as a # String formatted III (ex. '004').
read-only
curMinAsInt → int
Returns local current minute as an int (0...59).
read-only
curMinAsString → String
Returns local current DateTime's minute as a # String formatted MM (ex. '04').
read-only
curMonthAsInt → int
Returns current month as an int (January == 1 ... December == 12).
read-only
curMonthAsString → String
Returns local current month as a # String formatted MM (ex. '04').
read-only
curSecAsInt → int
Returns current second as an int (0...59).
read-only
curSecAsString → String
Returns local current DateTime's second as a # String formatted SS (ex. '04').
read-only
curWeekdayAsString → String
Returns current day of the week as a text String.
read-only
curYearAsInt → int
Returns current year as an int (ex. 2019).
read-only
curYearAsString → String
Returns local current year as a # String formatted YYYY (ex. '2019').
read-only
timeZoneOffsets ↔ Map<String, double>
All avaible timezones for dateTimeInZone. [...]
read / write

Functions

add({DateTime orig, int amount, String units}) → DateTime
Adds given amount (amount) of given units (units) to given DateTime (orig). [...]
curDateTimeByUtcOffset({double offset}) → DateTime
Takes a UTC offset, and returns the current DateTime with that offset. [...]
curDateTimeByZone({String zone}) → DateTime
Takes a timezone, and returns the current DateTime in that timezone. [...]
dateInWords(DateTime date) → String
Returns the given DateTime's date in words (ex. 'January 19, 2019').
dateTimeToOffset({double offset, DateTime datetime}) → DateTime
Takes a UTC offset and DateTime. [...]
dateTimeToZone({String zone, DateTime datetime}) → DateTime
Takes a timezone and Datetime. [...]
dayAsString(DateTime date) → String
Returns given DateTime's day as a # String formatted DD (ex. '04').
exactDiff({DateTime x, DateTime y, String units: "ms", bool asFloat: false}) → num
Returns exact amount of given unit (units) between the two DateTimes. This accounts for leapyears and other time-based anomalies. [...]
formatCurDate({String format: "MMDDYYYY", String divider: "/"}) → String
Formats the local current date into a string. [...]
formatCurTime({String format: "HHMMSS", String divider: ":", bool is24hr: false}) → String
Formats DateTime into a # string with the time. [...]
formatDate({DateTime date, String format: "MMDDYYYY", String divider: "/"}) → String
Formats DateTime into a # string with the date. [...]
formatTime({DateTime time, String format: "HHMMSS", String divider: ":", bool is24hr: true}) → String
Formats DateTime into a # string with the time. [...]
hrAsString(DateTime time) → String
Returns given DateTime's hour as a # String formatted HH (ex. '14').
microsecAsString(DateTime time) → String
Returns given DateTime's microsecond as a # String formatted III (ex. '004').
millisecAsString(DateTime time) → String
Returns given DateTime's millisecond as a # String formatted III (ex. '004').
minAsString(DateTime time) → String
Returns given DateTime's minute as a # String formatted MM (ex. '04').
monthAsString(DateTime date) → String
Returns given DateTime's month as a # String formatted MM (ex. '04').
secAsString(DateTime time) → String
Returns given DateTime's second as a # String formatted SS (ex. '04').
subtract({DateTime orig, int amount, String units}) → DateTime
Subtracts given amount (amount) of given units (units) from given DateTime (orig). [...]
weekdayAsString({DateTime date}) → String
Returns day of the week of given DateTime as a text String.
yearAsString(DateTime date) → String
Returns given DateTime's year as a # String formatted YYYY (ex. '2019').