LocalDateTime class
Represents a calendar date and time without a timezone.
Unlike DateTime, which represents an instant in time where a timezone is needed to convert to a 'calendar' date, LocalDateTime directly represents a calendar date without a timezone, so doesn't repesent any specific instant in time.
- Inheritance
-
- Object
- Comparable<
LocalDateTime> - LocalDateTime
Constructors
- LocalDateTime(int year, [int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0])
- LocalDateTime.fromDateTime(DateTime date)
-
Creates a new LocalDateTime from the
year
,month
,day
,hour
,minute
,second
,millisecond
andmicrosecond
properties of the given DateTime.
Properties
- day → int
-
The day of the month
[1..31]
.no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- hour → int
-
The hour of the day, expressed as in a 24-hour clock
[0..23]
.no setter - microsecond → int
-
The microsecond
[0...999]
.no setter - millisecond → int
-
The millisecond
[0...999]
.no setter - minute → int
-
The minute
[0...59]
.no setter - month → int
-
The month
[1..12]
.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- second → int
-
The second
[0...59]
.no setter - weekday → int
-
The day of the week DateTime.monday..DateTime.sunday.
no setter
- year → int
-
The year.
no setter
Methods
-
compareTo(
LocalDateTime other) → int -
Compares this object to another object.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
Returns the date in the format
YYYY-MM-DD'T'HH:MM:SS[.ssssss]
.override
Operators
-
operator ==(
Object other) → bool -
Returns true if
other
is a LocalDateTime with the same date and time.override
Static Methods
-
parse(
String formattedString) → LocalDateTime -
Creates a new LocalDateTime from a
formattedString
. -
tryParse(
String formattedString) → LocalDateTime? -
Creates a new LocalDateTime from a
formattedString
, ornull
if the string is not a valid time.