DateTimeConverter class
Converts arbitrary values into Date values using extended conversion rules:
- Strings: converted using ISO time format
- Numbers: converted using milliseconds since unix epoch
Example
var value1 = DateTimeConverter.toNullableDateTime('ABC'); // Result: null
var value2 = DateTimeConverter.toNullableDateTime('2018-01-01T11:30:00.0'); // Result: Date(2018,0,1,11,30)
var value3 = DateTimeConverter.toNullableDateTime(123); // Result: Date(123)
Constructors
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited
Static Methods
-
toDateTime(
dynamic value) → DateTime - Converts value into Date or returns current date when conversion is not possible. [...]
-
toDateTimeWithDefault(
dynamic value, DateTime defaultValue) → DateTime - Converts value into Date or returns default when conversion is not possible. [...]
-
toNullableDateTime(
dynamic value) → DateTime - Converts value into Date or returns null when conversion is not possible. [...]