-5

I need to extract the Day and month using Jquery so I'm left with 0913 . I also need to extract the date in this format too: 20130409, any suggestions on how to do so ? I know I can get the full date like this:

var fullDate = new Date();

Thanks!

user1937021
  • 10,151
  • 22
  • 81
  • 143

1 Answers1

0

Get a date string from a text box using jQuery:

var dateParts,
    myDate;

$calendarBox = $('input[id="myCalendarTextBox"]');

$(document).ready(function () {
    $calendarBox.datepicker({
        dateFormat= 'yy/mm/dd',
        onClose: function () {
            if($calendarBox.val() != '') {
                dateParts = $calendarBox.val().split('/');
                myDate = new Date(dateParts[0], dateParts[1], dateParts[2]);
            }
    });
});
Wim Ombelets
  • 5,097
  • 3
  • 39
  • 55