In the datePicker selected 20.04.2012
. I want to get this value, format it and store in a variable.
I uses this code:
var date = $("#scheduleDate").datepicker({ dateFormat: 'dd,MM,yyyy' }).val();
But result is 20.04.2012
.
Also, I tryed this code:
var dateTypeVar = $('#scheduleDate').datepicker('getDate');
$.datepicker.formatDate('dd-MM-yy', dateTypeVar);
Result is Fri Apr 20 2012 00:00:00 GMT+0600
.
I want to get the following: 20, April, 2012
How to format properly?
Thanks.
$("input").datepicker({ dateFormat: 'dd, mm, yy' });
later in your code when the date is set you could get it by
dateVariable = $("input").val();
dateString = $.datepicker.formatDate('dd, MM, yy', new Date("20 April 2012"));
I've updated the jsfiddle for experimenting with this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With