Showing Date in different format in javascript datepicker -
i new javascript , trying make date-picker widget, have selected date in mm/dd/yy format,how can date "thu(day),25th july(date,month) ,2013" kind of format , how set input value current date.here's fiddle, http://jsbin.com/idowik/3/ http://jsbin.com/idowik/3/edit there warnings , please bear me , please open output in new tab. thank you,
read docs date object: http://www.w3schools.com/jsref/jsref_obj_date.asp. need described there.
have @ following code:
<!doctype html> <html> <body> <input id="dateinput" type="text"></input> <button id="convertbutton">convert string</button> <a id="datestring"></a> <script type="text/javascript"> var dateinput = document.getelementbyid("dateinput"); var button = document.getelementbyid("convertbutton"); var datestring = document.getelementbyid("datestring"); var date; button.onclick = function() { var year = 2000+ parseint(dateinput.value.split("/")[2]); var month = dateinput.value.split("/")[0]; var day = dateinput.value.split("/")[1]; date = new date(year, month, day); datestring.innerhtml = date.todatestring(); } </script> </body> </html>
this html page want.
Comments
Post a Comment