0
How to transport Date and Time?
What is the best way to get the current Time, save it to firebase, and then, after downloading it at another device, showing it as a human-readable format? (in JS) Thanks in advance!
2 Antworten
+ 9
you can do something similar to this code which return a formatted string of the date
you can make the formatter function better by having it accept a format string ('dd/MM/YYYY' for example) which determines the output format
take into consideration tho that Firebase supplies its own timestamp which determined by the server and not on the client
https://firebase.google.com/docs/reference/js/firebase.database.ServerValue
https://code.sololearn.com/WZUdi030ES84/?ref=app
+ 4
I don't know about the firebase part but my code shows the time in a human readable format
https://code.sololearn.com/Woz98VH77WF1/?ref=app