timestamp to date flutter code example
Example 1: dart timestamp
void main() {
print(new DateTime.now().millisecondsSinceEpoch);
}
Example 2: how to convert timestamp to datetime in dart
Timestamp time;
DateTime.fromMicrosecondsSinceEpoch(time.microsecondsSinceEpoch)
Example 3: flutter date time to timestamp
DateTime currentPhoneDate = DateTime.now();
Timestamp myTimeStamp = Timestamp.fromDate(currentPhoneDate);
DateTime myDateTime = myTimeStamp.toDate();
print("current phone data is: $currentPhoneDate");
print("current phone data is: $myDateTime");
Example 4: convert datetime to TZDateTimeflutter
var time = tz.TZDateTime.from(
scheduledNotificationDateTime,
tz.local,
);