Sarah Macey Sarah Macey - 8 months ago 43
Javascript Question

Convert MySQL date format to DD/MM/YY date format using Javascript

I was wondering how I would go about converting the SQL timestamp format (2016-04-30T01:19:45.000Z) to a standard date format like (30/04/2016) using Javascript/front-end-technology.

Thanks in advance.


Hope this helps. This can be achieved in multiple ways - pure JavaScript, jQuery, Angular etc., As well it requires bit of tweaking based on your requirement. Do let me know if this helps

        var myDate = new Date('2010-10-11T00:00:00+05:30');
        alert((myDate.getMonth() + 1) + '/' + myDate.getDate() + '/' + myDate.getFullYear());