jquery - Extracting day, month and year from calendar tables -
i working on booking system built in codeigniter. have modified calendar library show 4 next weeks. want user able choose check in , check out dates. when corresponding calendar shows, user pushes date, , value stored in hidden input, using jquery. if late in month, there might 2 months showing, in other words 2 calendar tables.
what best way store date using jquery? table cells showing day, while table heading showing "month year".
the best way use javascript date object. http://www.w3schools.com/js/js_obj_date.asp
edit: create date object
var date = new date(2011, 6, 4); //assigns july 4th, 2011 date var edit: if want values cells asked:
var year = $("th#year").text(); var month = parseint($("td#month").text(), 10)-1; //-1 cause january 0 var day = $("td#day").text(); var date = new date(year, month, day);
Comments
Post a Comment