-1

I have the below Data Format which I need to format to dd-mm-yyyy or dddd-mm-yyy. What would be the best way of doing so in JavaScript?

Fri Jun 30 2017 00:00:00 GMT+0100 (GMT Daylight Time)
2

1 Answer 1

0

enter image description here

new Date(2017, 03, 07).toString(); // ""Fri Apr 07 2017 00:00:00 GMT+0530 (India Standard Time)"

enter image description here

Sign up to request clarification or add additional context in comments.

5 Comments

@Dinistro For more additional date formats specific to region u can use moment js otherwise u can use the above one
I dont understand how new Date(2017, 03, 07).toString(); works here?
@Jaron787 see my edited answer with screenshot it works !!!
I'm wanting to change my format from Fri Apr 07 2017 00:00:00 GMT+0530 (India Standard Time) to 2017, 03, 07 not the other way round
@Jaron787 Try this var a = moment().format('YYYY DD MM') console.log(a); // 2017 07 03

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.