3

I am displaying a date which takes the following format;

Sun Feb 24 2013 00:00:00 GMT-0800 (Pacific Standard Time)

All what i want is Sunday February 24 2013. How could i format the above date to the format i want ?

var date = $(this).datepicker('getDate');
                  theDay = new Date(date.getFullYear(), date.getMonth(), date.getDate());
4

1 回答 1

2

Using the DatePicker

$(this).datepicker({
    dateFormat: "DD MM d yy"
});

Example here: http://jsfiddle.net/eJseP/


Edited, by request:

<input type="text" id="myinputfield" value="" />
<script>
    $("#myinputfield").datepicker({
        dateFormat: "DD MM d yy"
    });
<script>
于 2013-02-15T20:33:50.363 回答