Utilizing Firebase in my chat application, I am adding a timestamp to the chat object using the Firebase.ServerValue.TIMESTAMP
method.
I want to display the time when the message was received in the chat application using this timestamp.
If it is the current time, only the time should be shown. If there is a difference of days, then the date and time or just the date should be displayed.
I have attempted the following code to convert the Firebase timestamp but I am not getting the accurate time:
var timestamp = '1452488445471';
var myDate = new Date(timestamp*1000);
var formattedTime = myDate.toJSON();
Please provide a solution for this problem.