JS Gets the current date time var mydate = new Date (); Mydate.getyear (); Gets the current year (2-bit) mydate.getfullyear (); Get the full year (4-bit, 1970-????) Mydate.getmonth (); Get the current month (0-11, 0 for January) mydate.getdate (); Get current day (1-31) mydate.getday (); Get Current week x (0-6, 0 for Sunday) mydate.gettime (); Gets the current time (the number of milliseconds starting in 1970.1.1) mydate.gethours (); Gets the current number of hours (0-23) mydate.getminutes (); Gets the current number of minutes (0-59) mydate.getseconds (); Gets the current number of seconds (0-59) mydate.getmilliseconds (); Gets the current number of milliseconds (0-999) mydate.tolocaledatestring (); Gets the current date var mytime=mydate.tolocaletimestring (); Gets the current time mydate.tolocalestring (); Gets the date and time//day of the month var curmonthdays = new Date (Mydate.getfullyear (), (Mydate.getmonth () +1), 0). GetDate (); */days of the month Var Curmonthdays = new Date (Mydate.getfullyear (), (Mydate.getmonth () +1), 0). GetDate (); Support positioning function JS part: Var year = 2005;var Month = 12;var day = 20; {literal}$ (document). Ready (function () {set_date_select (Year,month,day), $ (' #month '). Change (function () {var tmp_ Year = $ ("#year"). Val (); var tmp_month = $("#month"). Val (); Set_date_select (tmp_year,tmp_month,0);}); function Set_date_select (year,month,day) {$ ("#year"). empty (); $ ("#month"). empty (); $ ("#day"). empty ();//year var mydate = New Date (), var year_num = Mydate.getfullyear () -1900+1;for (var i=0;i<year_num;i++) {var tmp_year = 1900+i;if (tmp_year = = year) $ (' #year '). Append ("<option value= '" +tmp_year+ "' selected= ' selected ' >" +tmp_year+ "</option>"); else$ (' #year '). Append ("<option value=" "+tmp_year+" ' > "+tmp_year+" </option> ");} Month for (Var i=1;i<=12;i++) {if (i = = month) $ (' #month '). Append ("<option value=" "+i+" ' selected= ' selected ' > "+i+ "</option>"), else$ (' #month '). Append ("<option value=" "+i+" ' > "+i+" </option> ");} Days of the month var curmonthdays = 31;if (Month > 0 && month <=) {var curmonthdays = new Date (Mydate.getfullyear (), ( Month), 0). GetDate ();} Daily for (Var i=1;i<=curmonthdays;i++) {if (i = = day) $ (' #day '). Append ("<option value=" "+i+" ' selected= ' selected ' > "+i+" </option> "); else$ (' #Day '). Append ("<option value=" "+i+" ' > "+i+" </option> ");}} HTML section: <select name= "Year" id= "year" ></select><select name= "month" id= "month" ></select> <select name= "Day" id= "Day" ></select>
JS Gets the current date time