-2

I have a value like the following Sun May 31 23:59:00 EDT 2015 and i want to convert this to 31/05/2015

How to convert this using javascript Date?

Manu
  • 3,979
  • 7
  • 21
  • 25
  • Everything you need to know about [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). – Teemu Jul 09 '14 at 04:37
  • Answer could be possibly [Formatting Date](http://stackoverflow.com/a/1056730/769678) – Shubh Jul 09 '14 at 05:41

1 Answers1

0
var d = new Date("Sun May 31 23:59:00 EDT 2015");
var f_date = d.getDate();
var f_month = d.getMonth()+1;
var f_year = d.getFullYear();
new_string=f_date+"/"+f_month+"/"+f_year;

added 1 into month( as it starts from 0) New_string is date in required format

Note- it will be given according to local timezone

Trishul
  • 998
  • 1
  • 7
  • 17