I have a text item in which date return from calender in formate like dd/mm/yyyy now i want to convert this formate to dd-mon-yyyy in javascript...How i can do this.?

Recommended Answers

All 3 Replies

InDate='20/10/2014'; // Example
Items=InDate.split('\/');
Months=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
OutDate=Items[0]+'-'+Months[Items[1]-1]+'-'+Items[2];

it's working just fine here, the script output is correct: "20-Oct-2014"

sir. thanks for the reply but why we need array for all months ...i just return the date from the calender in text item and want to apply date formate on that text item.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.