Page 1 of 1

change date format before adding to database

Posted: Wed May 07, 2014 5:12 am
by Josh Snow

I am using the datepicker component and using the following format dd-mm-yy because it's more intuitive for the user. Before I add the value to the data though I believe I need to adjust the date to yyyy-mm-dd

I think I can use this code to do that?
return $.datepicker.formatDate( "yyyy-mm-dd", $.datepicker.parse( "dd-mm-yyyy", value_str) );

but I can't figure out how to just alert me what the new date is so I can check in the test mode.


change date format before adding to database

Posted: Wed May 07, 2014 6:32 am
by Evgene Karachevtsev

Hello Josh,

You should use this sintax to parse date: $.datepicker.parseDate( format, value, settings )
(http://api.jqueryui.com/datepicker/)
Add alert with your code before invocation of return.


change date format before adding to database

Posted: Tue May 13, 2014 9:37 pm
by Josh Snow

When I do the alert all I get is "object Object" which seems to me means it's an array. Not sure what to do so I can actually see the date in the alert?


change date format before adding to database

Posted: Wed May 14, 2014 5:03 pm
by Evgene Karachevtsev

"object Object" means that you try show object. If you want to show object try this javascript code:

code alert(JSON.stringify(object));/code