1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <MetaCharSet= "UTF-8">5 <title>The Date object of JS</title>6 <Scripttype= "Text/javascript">7 varDate= NewDate ();8 document.write ("Current Date:" +date);9 //tolocalestring () method to convert a Date object to a string based on the local time formatTen document.write ("<br/> Format tolocalestring () method:" +date.tolocalestring ()); One //getFullYear () method to get the current four-digit year A document.write ("<br/> Year getfullyear ():" +date.getfullyear ()); - //GetMonth () method, gets the current month (0-11) - document.write ("<br/> Month getMonth ():" +(Date.getmonth ()+ 1)); the //GetDay () method, gets the current week (0-6), foreign friends put Sunday as the first day of the week, so Sunday returns 0 - document.write ("<br/> Week getDay ():" +date.getday ()); - //getDate () method, gets the current day (1-31) - document.write ("<br/> Day getDate ():" +date.getdate ()); + //getHours () method, gets the current hour (0-23) - document.write ("<br/> Hours getHours ():" +date.gethours ()); + //getminutes () method, gets the current minute (0-59) A document.write ("<br/> min getminutes ():" +date.getminutes ()); at //getseconds () method, gets the current second (0-59) - document.write ("<br/> Seconds getseconds ():" +date.getseconds ()); - //getmilliseconds () method, gets the current millisecond (0-999) - document.write ("<br/> Ms Getmilliseconds ():" +date.getmilliseconds ()); - //GetTime () method to get the number of milliseconds since January 1, 1970 - /* in use milliseconds to handle caching effects (no cache) - the value of Http://www.baidu.com?getTime () to */ + document.write ("<br/>1970 Year January 1 to present number of milliseconds getTime ():" +date.gettime ()); - </Script> the </Head> * <Body> $ Panax Notoginseng </Body> - </HTML>
The date object of the JavaScript base 17--js