i'm able to show the "default" date with this format: Thu Jan 01 1970 01:01:00 GMT+0100
And i want to get this format: Thursday, 09 Jan 2017 06:00
Code i have so far: (Not written by me)
var date = new Date(customData[0].timestamp*1000);
// Hours part from the timestamp
var hours = date.getHours();
// Minutes part from the timestamp
var minutes = "0" + date.getMinutes();
// Seconds part from the timestamp
var seconds = "0" + date.getSeconds();
// Will display time in 10:30:23 format
var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
If i call the variable "date":
Thu Jan 01 1970 01:01:00 GMT+0100
If i call the variable "formattedDate":
0:00:00
I call the variable using:
<Text style={textStyles.text_dies_mostrats}>{formattedTime.toString()}</Text>
Any ideas?
new Date()so I suspect there is some problem with your custom data, could you print justcustomData[0].timestamp? - Facundo La RoccacustomData[0].timestampbe coming null or undefined? - Facundo La Rocca