Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove leading "0" in day and month in jQuery UI datepicker

My question is similar to Remove Leading "0" in day of month SimpleDateFormat

Is it possible to remove the leading "0" in jquery UI datepicker?

The DateFormat option is as close as I could get from the documentation:

$( ".selector" ).datepicker({ dateFormat: "yy-mm-dd" });

But what I need is on a date like Dec 5th, 2012, datepicker shows it as 12/05/2012 whereas I would like to have 12/5/2012. Same goes for April 5th: 4/5/2013 for example.

Can this be done without an extensive logic?

like image 444
greener Avatar asked Dec 20 '12 06:12

greener


1 Answers

Try

$( ".selector" ).datepicker({ dateFormat: "yy-m-d" });

Source:Jquery DateFormats

like image 145
rs. Avatar answered Sep 30 '22 19:09

rs.