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
    });
};
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Comments

You can leave a response, or trackback from your own site.

Before you add comment see for rules.

Leave a Reply

Your email address will not be published. Required fields are marked *

1p4l9z