This article mainly introduces javascript date computation, which involves related techniques related to javascript date computation. you need to pay attention to the use of indexes. if you need it, you can refer to the following example to describe javascript date computation. Share it with you for your reference. The details are as follows:
Function setLeaveDate () {var inDay = $ ("# date_6 "). val (); // The obtained date format is 2014-07-03 var date = inDay. split ('-'); // separate dates into numbers var num = $ (". time_lk "). val () * 1; // The number of days to be added var year = date [0] * 1; var month = date [1] * 1; var day = date [2] * 1 + num; var d = new Date (month + "/" + day + "/" + year); // Get a date object, note: Here the month and calendar correspond to var weekday = new Array (7); // add an Array of weekday displayed in the resolution week [0] = "Sunday "; weekday [1] = "Monday"; weekday [2] = "Tuesday"; weekday [3] = "weekday "; Weekday [4] = "Thursday"; weekday [5] = "Friday"; weekday [6] = "Saturday"; month = d. getMonth () + 1; // Note: the month here is still changed, and the index of the month is 0 ~ 11, // therefore, adding 1 here will change back to the month corresponding to the calendar. result = month + "month" + d. getDate () + "day
"+ Weekday [d. getDay ()] +" leaving "; $ (". time_2 "). text (result );}
I hope this article will help you design javascript programs.