Split Date Output

72 views
Skip to first unread message

Richard Warner

unread,
May 21, 2014, 9:09:24 AM5/21/14
to bootstrap-...@googlegroups.com
Hi,

I'm working on using this datepicker to update an old legacy booking system. I have managed to get the date format without the leading zero but need a way to split up the date into three parts similar to what i have below. Is this possible or can someone point me in the right direction.

$('#full').datepicker({
  format
: "d/m/yyyy",
  todayBtn
: true,
  todayHighlight
: true
  onSelect
: function(dateText, inst) {
     
var pieces = dateText.split('/');
        $
('#day').val(pieces[0]);
        $
('#month').val(pieces[1]);
        $
('#year').val(pieces[2]);
     
}
})

Many thanks



Reply all
Reply to author
Forward
0 new messages