Ejemplo 1: cómo convertir la marca de tiempo a fecha y hora en dart
Timestamp time; //from firebase
DateTime.fromMicrosecondsSinceEpoch(time.microsecondsSinceEpoch)
Ejemplo 2: flutter date time to timestamp
DateTime currentPhoneDate = DateTime.now(); //DateTime
Timestamp myTimeStamp = Timestamp.fromDate(currentPhoneDate); //To TimeStamp
DateTime myDateTime = myTimeStamp.toDate(); // TimeStamp to DateTime
print("current phone data is: $currentPhoneDate");
print("current phone data is: $myDateTime");
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)