Date formatting for javascript

I am displaying a date that takes the following format:

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

All I want is this Sunday February 24 2013

. How can I format the specified date in the format I want?

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

      

+3


source to share


1 answer


Using DatePicker

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

      

An example is here: http://jsfiddle.net/eJseP/




Edited, as requested:

<input type="text" id="myinputfield" value="" />
<script>
    $("#myinputfield").datepicker({
        dateFormat: "DD MM d yy"
    });
<script>

      

+2


source







All Articles