Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am having date in
JavaScript
"25/7/2014"

i want to parse it into
JavaScript
"25/07/2014"
how to parse it?

Please help me ASAP.
Thanks in advance.
Posted
Comments
Sergey Alexandrovich Kryukov 25-Jul-14 3:10am    
In the sense you use in "parse into", this is not called "parsing". Parsing is from string into data, and then you perform ToString from data.
—SA

when working with date object in JavaScript, Moment.js[^] would be your best friend ...

here is the example JsFiddle[^]
C#
var dateString = "25/7/2014";

/*string to date object*/
var date = moment(dateString, "DD/M/YYYY");
/*date object to datestring*/
dateString = date.format("DD/MM/YYYY");

alert(dateString);
 
Share this answer
 
Please try

DateTimeNow.ToString("MMMM dd, yyyy")

Thanks
Ravi
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-Jul-14 3:10am    
Totally irrelevant to the question, sorry.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900