The date object of the JavaScript base 17--js

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.