learning
learning

Reputation: 11725

How to format date

I have a date as "Thursday, 4 Aug 2011". How do I format it to "yyyy/MM/dd"? I have tried the codes:

var myDate =   dateText.toString("yyyy/MM/dd");
myDate = Date.parseExact(myDate, "yyyy/MM/dd")

but none seem to work. Help please.

Upvotes: 2

Views: 135

Answers (2)

thecodeparadox
thecodeparadox

Reputation: 87073

you may use datejs

Upvotes: 1

Jerome Cance
Jerome Cance

Reputation: 8183

here is a post on the subject : http://blog.stevenlevithan.com/archives/date-time-format

you also have this jquery plugin : http://plugins.jquery.com/project/jquery-dateFormat

Upvotes: 0

Related Questions