0

How do i convert a date of the format dd/MM/yyyy (eg:29/04/2016) to the format ddd,MMM yyyy (eg: Fri, 29 Apr 2016)?

Irshu
  • 8,248
  • 8
  • 53
  • 65
  • 2
    Take a look of [How to format a JavaScript date](http://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date) – Blank Apr 29 '16 at 05:33
  • Welcome to SO. Please visit the [help] to see what and how to ask. Hint: Do a search first, then show your effort with the code you tried – mplungjan Apr 29 '16 at 05:34
  • Since it was just a few days ago I wrote a new script, here you are as a welcome present: https://jsfiddle.net/mplungjan/u0sux9d2/ – mplungjan Apr 29 '16 at 05:36
  • 1
    @mplungjan thank you this was i looking for :)' – BeDeveloper Apr 29 '16 at 05:43
  • @mplungjan—that question is not a full duplicate of this one. The OP has a string, not a Date, so it is not just about formatting a date string from a date. – RobG Apr 30 '16 at 05:20
  • Before you can use mplungjan's code you must first convert your string to a Date. See the answer [*here*](http://stackoverflow.com/questions/24078497/date-format-automatically-changed-from-dd-mm-yyyy-to-mm-dd-yyyy/24078641#24078641). – RobG Apr 30 '16 at 05:25
  • @RobG take a closer look at my fiddle - I have `var inp = "29/04/2016".split("/");` - I even use European format as OP did. There is only room for one duplicate and string splitting is another question – mplungjan Apr 30 '16 at 05:41
  • @mplungjan—cool, I don't know why you call it "European format", it's used far more widely than that and isn't the only format used in Europe. – RobG May 01 '16 at 07:10
  • As opposed to the "native us" format assumed by JS. mm/dd/yyyy or mm-dd-yyyy – mplungjan May 01 '16 at 07:14

0 Answers0