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').
no setter
- curDayAsInt → int
-
Returns current day as an int (1 ... 31).
no setter
- curDayAsString → String
-
Returns local current day as a # String formatted DD (ex. '04').
no setter
- curHrAsInt → int
-
Returns local current hour as an int (1...24).
no setter
- curHrAsString → String
-
Returns local current DateTime's hour as a # String formatted HH (ex. '14').
no setter
- curMillisecAsInt → int
-
Returns current millisecond as an int (0...999).
no setter
- curMillisecAsString → String
-
Returns local current DateTime's millisecond as a # String formatted III
(ex. '004').
no setter
- curMinAsInt → int
-
Returns local current minute as an int (0...59).
no setter
- curMinAsString → String
-
Returns local current DateTime's minute as a # String formatted MM (ex. '04').
no setter
- curMonthAsInt → int
-
Returns current month as an int (January == 1 ... December == 12).
no setter
- curMonthAsString → String
-
Returns local current month as a # String formatted MM (ex. '04').
no setter
- curSecAsInt → int
-
Returns current second as an int (0...59).
no setter
- curSecAsString → String
-
Returns local current DateTime's second as a # String formatted SS (ex. '04').
no setter
- curWeekdayAsString → String
-
Returns current day of the week as a text String.
no setter
- curYearAsInt → int
-
Returns current year as an int (ex. 2019).
no setter
- curYearAsString → String
-
Returns local current year as a # String formatted YYYY (ex. '2019').
no setter
-
timeZoneOffsets
↔ Map<
String, double> -
All avaible timezones for
dateTimeInZone
.getter/setter pair
Functions
-
add(
{required DateTime orig, required int amount, required String units}) → DateTime - Adds given amount (amount) of given units (units) to given DateTime (orig).
-
curDateTimeByUtcOffset(
{required double offset}) → DateTime - Takes a UTC offset, and returns the current DateTime with that offset.
-
curDateTimeByZone(
{required 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(
{required double offset, required DateTime datetime}) → DateTime - Takes a UTC offset and DateTime.
-
dateTimeToZone(
{required String zone, required 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(
{required DateTime x, required 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(
{required DateTime date, String format = 'MMDDYYYY', String divider = '/'}) → String - Formats DateTime into a # string with the date.
-
formatTime(
{required 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(
{required DateTime orig, required int amount, required String units}) → DateTime - Subtracts given amount (amount) of given units (units) from given DateTime (orig).
-
weekdayAsString(
{required 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').