Examples of common methods for date objects in JavaScript _ basics

Source: Internet
Author: User

getFullYear ()
use getFullYear () to get the year.
Source:

</script>
<! DOCTYPE html>
 
 

Test results:

2015


GetTime ()
GetTime () returns the number of milliseconds since January 1, 1970.
Source:

<! DOCTYPE html>
 
 


Test results:

1445669203860

setFullYear ()
How to set a specific date using setfullyear ().
Source:

<! DOCTYPE html>
 
 

Test results:

Tue Nov 2020 14:47:46 gmt+0800 (China Standard Time)

toUTCString ()
How to use toUTCString () to convert the date of day (based on UTC) to a string.

Source:

<! DOCTYPE html>
 
 

Test results:

Sat, OCT 2015 06:49:05 GMT

Getday ()
How to use Getday () and arrays to display weeks, not just numbers.
Source:

<! DOCTYPE html>
 
 

Test results:

Saturday

Display a clock
How to display a clock on a Web page.
Source:

<! DOCTYPE html>
 
 


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.