javascript - new date() formatting -


i've been stuck on while , need help.
have date/time displayed using "new date()".
works perfect except in need display yyyy mmm dd hh:mm:ss.
displays "thu may 31 2012 13:04:29 gmt-0500 (cdt)".
need "2012 may 31 13:04:29".

any awesome! thanks

i love using moment.js when i'm doing lots of complex , different date formatting, should work too:

var m_names = new array("january", "february", "march",  "april", "may", "june", "july", "august", "september",  "october", "november", "december");  var mydate = new date(); var curr_date = mydate.getdate(); var curr_month = mydate.getmonth(); var curr_year = mydate.getfullyear();  var mydatestr = '' + curr_year  + ' ' + curr_month + ' ' +  curr_date+ ' ' + mydate.gethours() + ':' + mydate.getminutes() + ':' +  mydate.getseconds() 

..edit.. here's how simple if using moment.js

var day = new date() var daywrapper = moment(day);  var daystring = daywrapper.format("yyyy mmm d h:mm:ss");  

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -