views:

64

answers:

1

how do you format a date into the format 30-Apr-10 in javascript?

+4  A: 

There are a few libraries out there for this, you can use something like Date Format (under 4kb completely uncompressed), then your usage would be like this:

var currentDateString = new Date().format("dd-mmm-yy");

Though, if possible, I'd stick to 4-digit years :)

Nick Craver
If using ASP.NET AJAX a format function is available: http://msdn.microsoft.com/nb-no/library/bb310850.aspx
knut