LocalDateTime.now constructor

LocalDateTime.now()

Returns the current local date and time.

Example:

final now = LocalDateTime.now();

A date-time object without a timezone, composed of a LocalDate and LocalTime.

This class represents a specific moment on a calendar, combining a date and time without referencing any timezone. It is immutable and supports arithmetic and comparison operations.

Example:

final dateTime = LocalDateTime.of(2024, 12, 31, 23, 59);
print(dateTime); // 2024-12-31T23:59:00

Implementation

factory LocalDateTime.now() {
  final now = DateTime.now();
  return LocalDateTime.fromDateTime(now);
}