jleich Posted March 12, 2012 Share Posted March 12, 2012 binding some data to a componentart datagrid. the date comes in as yymmdd (120312) and for display I do a string format "MM/dd/yyyy". If a user has selected an item in the grid I use a javascript function to loop through the items and build an xml string to update some database records. When getting to the date column it shows Mon Mar 12 00:00:00 CST 2012. Want to reformat that to MM/dd/yyyy before sending off to database. Help?? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 12, 2012 Share Posted March 12, 2012 You can use the various methods of the Date object to format it however you want: http://www.w3schools.com/jsref/jsref_obj_date.asp Link to comment Share on other sites More sharing options...
jleich Posted March 12, 2012 Author Share Posted March 12, 2012 Thanks! I did end up with getting what I wanted with below...if (newAtt.name == "InvoiceDate") {var now = new Date(gridItem.get_cells().Value);var curr_date = now.getDate();var curr_month = now.getMonth();curr_month++;var curr_year = now.getFullYear();newAtt.nodeValue = curr_month + "/" + curr_date + "/" + curr_year; Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.