I have Timestamp item in firebase. I get the item from dart code timestamp type.
It shows like ‘Timestamp(seconds=1590903768, nanoseconds=26999000)’ as it is.
I would like to show on my Application only Date like ‘2020-06-01′ or ’06-01’.
Please give me advice.
Timestamp class has a
toDate function that converts it to a
DateTime object. See this for more information. Any formatting you want to do in converting it to a string can be done more easily now with
intl package formatters.
Timestamp stamp = Timestamp.now(); DateTime date = stamp.toDate();
Answered By – Christopher Moore