Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript: How to convert given date into readable format [duplicate]

Tags:

javascript

I have date in ISO-format like:

2016-02-17T16:40:30

How can I convert it to a human-readable date, for example:

17 Feb 2016 16:40
like image 216
yoram Avatar asked Feb 23 '16 12:02

yoram


1 Answers

First of all, you need to create a date using your original date string.

var d = new Date('2016-02-17T16:40:30');

And then you can use this to fetch a readable date format:

d.toDateString();

Will return:

Wed Feb 17 2016

like image 117
Maccath Avatar answered Sep 22 '22 10:09

Maccath