views:

51

answers:

2

I want to display date like this in my website "Wednesday, March 03, 2010 05:44:15 PM".

If I use JavaScript it will take lengthy code. Is there any other way to do this?

+1  A: 

I think you can format it in the server side.

virsir
+5  A: 

You may be interested in the Datejs library.

You can easily try it out by including the datejs script in your HTML file:

<script type="text/javascript" 
        src="http://datejs.googlecode.com/files/date.js"&gt;&lt;/script&gt;

You can then use toString() method to format the date as required:

new Date().toString("dddd, MMMM dd, yyyy hh:mm:ss tt");

// returns "Wednesday, March 03, 2010 01:40:18 PM"
Daniel Vassallo