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>
jorame22
Member
62 Points
19 Posts
How to format the date on jquery.date_input.pack from Jon Leighton?
Feb 28, 2012 11:27 PM|LINK
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></div>athar_techsa...
Member
554 Points
316 Posts
Re: How to format the date on jquery.date_input.pack from Jon Leighton?
Feb 29, 2012 06:28 AM|LINK
hi
I have an example of date formats in jQuery using Moment.js.
here is my sample code
<script type="text/javascript" language="javascript"> $(document).ready(function () { $("#btnDisable").click(function () { var now = moment(); window.alert(now.format('LLLL')); //window.alert(now.format('dddd, MMMM Do YYYY, h:mm:ss a')); // ***** Other formats //var halloween = moment([2011, 9, 31]); \\ October 31st //console.log(halloween.fromNow()); // var now = moment(); // moment.lang('fr'); // console.log(now.format('LLLL')); }); }); </script>athar_techsa...
Member
554 Points
316 Posts
Re: How to format the date on jquery.date_input.pack from Jon Leighton?
Feb 29, 2012 06:30 AM|LINK
hi
here is the link. hope this helps
http://momentjs.com/