views:

213

answers:

4

i would have thought this was:

.datepicker({ dateFormat: 'dd-mmm-yyyy' });

for month, i get some number that i dont understnad where they are coming from:

+3  A: 

According to the documentation, a single M is "Month name short" and "yy" is "Four Digit Year."

dd-M-yy
Jonathan Sampson
+1  A: 

You want:

$('.selector').datepicker({ dateFormat: 'dd-M-yy' });

See the docs.

The date format strings are somewhat non-standard:

d - day of month (no leading zero)
dd - day of month (two digit)
o - day of the year (no leading zeros)
oo - day of the year (three digit)
D - day name short
DD - day name long
m - month of year (no leading zero)
mm - month of year (two digit)
M - month name short
MM - month name long
y - year (two digit)
yy - year (four digit)
@ - Unix timestamp (ms since 01/01/1970)
'...' - literal text
'' - single quote
anything else - literal text

Dominic Rodger
+1  A: 

This is a case where looking into the documentation is most helpful:

*  d - day of month (no leading zero)
* dd - day of month (two digit)
* o - day of the year (no leading zeros)
* oo - day of the year (three digit)
* D - day name short
* DD - day name long
* m - month of year (no leading zero)
* mm - month of year (two digit)
* M - month name short
* MM - month name long
* y - year (two digit)
* yy - year (four digit)
* @ - Unix timestamp (ms since 01/01/1970)
* '...' - literal text
* '' - single quote
* anything else - literal text 
Pekka
A: 

The correct way is dd-M-yy

Alternatively you can use the monthNamesShort option for custom names ..

Gaby