Date.fromDateTime constructor

Date.fromDateTime(
  1. DateTime dateTime
)

Constructs a date from DateTime.

final date = Date.fromDateTime(DateTime.now());

Implementation

factory Date.fromDateTime(DateTime dateTime) {
  return Date(dateTime.year, dateTime.month, dateTime.day);
}