import { getFirestore,serverTimestamp} from "firebase/firestore";
//
const newTimeStamp=Timestamp.now();
For the format to be understandable for the user we have to do a conversion.
const ConvertDate= (d) => {
const newDate = new Date(d.seconds*1000)
return newDate.toLocaleString();
}
When we want to get the format we just call this function done with javascript
const normalformat=ConvertDate(newTimeStamp);
Result
print 17/8/2022, 10:45:33
or
const newTimeStamp=Timestamp.now().toMillis();
const newDat=ConvertDate2(newTimeStamp);
const ConvertDate2= (d) => {
const newDate = new Date(d)
return newDate.toLocaleString();
}
Top comments (0)