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");
Timestamp time; //from firebase
DateTime.fromMicrosecondsSinceEpoch(time.microsecondsSinceEpoch)
Timestamp t = document['timeFieldName'];
DateTime d = t.toDate();
print(d.toString()); //2019-12-28 18:48:48.364
DateFormat.yMMMd().add_jm().format(myDateTime);
Map<String, dynamic> map = docSnapshot.data()!;
DateTime dt = (map['timestamp'] as Timestamp).toDate();
void main() {
String test = "10:12:23.24";
String hr = test.split(":")[0];
// print(hr);
String minutes = test.split(":")[1];
// print(minutes);
String seconds = test.split(":")[2].split(".")[0];
// print(seconds);
String milliseconds = test.split(":")[2].split(".")[1];
// print(milliseconds);
Duration duration = Duration(
hours: int.tryParse(hr) ?? 0,
minutes: int.tryParse(minutes) ?? 0,
seconds: int.tryParse(seconds) ?? 0,
milliseconds: int.tryParse(milliseconds) ?? 0);
print(duration.inMilliseconds);
}