1

I have a textbox with dates out of a database, the dates are in the following format:

2012/06/12 12:00:00 AM

That is what they display in the textbox.

I want them to display "dd M yy"

06 Jun 2012

How can Format the textbox to display the date like this.

I can get today's date to display in this format with the following code:

    $('.DatePicker').datepicker({       
            dateFormat: "dd M yy"
        });
$('.DatePicker').datepicker('setDate', new Date());
Pomster
  • 14,567
  • 55
  • 128
  • 204

1 Answers1

3

This question was already asked. There are lots of reasonable answers here:

Where can I find documentation on formatting a date in JavaScript?

My suggestion is that you use DateJS. It will allow you to use the toString('dd M yy') formatting you're looking for.

http://www.DateJS.com

Community
  • 1
  • 1
Josh Siok
  • 936
  • 4
  • 8