Fishstick Kitty Fishstick Kitty - 8 months ago 77
jQuery Question

Jquery Globalize dateformatter how to format months with leading zeros

When I look at the documentation I can't find a way to do this...but I have the following formatter:

Globalize.dateFormatter({skeleton: "yMd"});

And it produces dates like: 8/24/2015. What I would like is 08/24/2015.

Here is a fiddle:

Any advice?


i had a look in Docs , but i didn't find a format for dd/MM/yyyy , so added it as one format , try this


JS (I am just providing a part of code here, see demo)

f = Globalize.dateFormatter({
    skeleton: "myFormat"

and data variable

"dateTimeFormats": { 
    "medium": "{1}, {0}",
        "availableFormats": {    
            "myFormat": "dd/MM/yyyy",
            // other formats

now use can use whatever the format (only valid format) you want in myFormat and you are free to change the name of myFormat.