My timestamp returns Timestamp(seconds=1560523991, nanoseconds=286000000) in a Flutter Firestore snapshot.
Timestamp(seconds=1560523991, nanoseconds=286000000)
I want to print it as properly formatted date and
timestamp parameter is the time in seconds
String formatTimestamp(int timestamp) { var format = new DateFormat('d MMM, hh:mm a'); var date = new DateTime.fromMillisecondsSinceEpoch(timestamp * 1000); return format.format(date); }
Please check this answer for intl date formats
Hope it helps !