Have you ever tried to create date from timestamp using JavaScript? After some testing code I found the solution. This is what i use:
var getDateFromTimestamp = function( t )
{
var a = new Date(t);
a =
{
day : a.getDate(),
month : a.getMonth() + 1,
year : String( a.getFullYear() ),
hours : a.getHours(),
minutes : a.getMinutes()
};
if( a.month < 10 )
{
a.month = '0' + a.month;
}
if( a.minutes < 10 )
{
a.minutes = '0' + a.minutes;
}
var fulldate = [a.day, a.month, a.year].join('.'),
time = [a.hours, a.minutes].join(':');
return ({
fulldate : fulldate,
time : time
});
};
Leave a Reply