Is any one familiar with the plugin jquery.date_input.pack from Jon Leighton? I’m trying to format the date to yyyymmdd but I’m able to get it right. Any help will be appreciate it.
Here is the code I’m trying to use:
<script type="text/javascript">
// Date picker
$('input.date_picker').date_input()
$ (function (date) {
var month = (date.getMonth() + 1).toString();
var dom = date.getDate().toString();
if (month.length == 1) month = "0" + month;
if (dom.length == 1) dom = "0" + dom;
return date.getFullYear() + "-" + month + "-" + dom;
}
});
</script>
I would recommend using date.js instead. It has native options for setting to format to whatever you need it to be.
http://code.google.com/p/datejs/wiki/APIDocumentation
then look at the date.parseExact method