Hi i want to convert the current date to a format as follows in javascript: Apr 12, 2011 06:42:03.
Any suggestions?????
Hi i want to convert the current date to a format as follows in javascript: Apr 12, 2011 06:42:03.
Any suggestions?????
 
    
    Little example I just whipped up for you. Very easy to tell whats going on.
var monthNames = new Array("January", "February", "March", 
"April", "May", "June", "July", "August", "September", 
"October", "November", "December");
var today = new Date();
var cDate = today.getDate();
var cMonth = today.getMonth();
var cYear = today.getFullYear();
var cHour = today.getHours();
var cMin = today.getMinutes();
var cSec = today.getSeconds();
alert( monthNames[cMonth] + " " +cDate  + "," +cYear + " " +cHour+ ":" + cMin+ ":" +cSec );
 
    
    Have you looked at this
dateFormat(now, "mmm dd, yyyy hh:MM:ss");
it is light weight (1.2 KB) and supports the following formats
 
    
    You may be interested in http://www.datejs.com/
thanks for the comments guys, I should of really linked more directly to the formatting options.
 
    
    This small library duplicates the strftime() functionality available in other languages in JavaScript.
