Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the date-time methods in javascript

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "what are the date-time methods in javascript". In daily operation, I believe that many people have doubts about the date-time methods in javascript. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "what are the date-time methods in javascript?" Next, please follow the editor to study!

The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.

Date-time method in javascript

The method describes the date and time that Date () returns for the day. GetDate () returns the day of the month (1-31) from the Date object. GetDay () returns the day of the week (0-6) from the Date object. GetMonth () returns the month (0-11) from the Date object. GetFullYear () returns the year in four digits from the Date object. Use the getFullYear () method instead of getYear (). GetHours () returns the hours of the Date object (0-23). GetMinutes () returns the minutes of the Date object (0-59). GetSeconds () returns the number of seconds of the Date object (0-59). GetMilliseconds () returns the milliseconds (0-999) of the Date object. GetTime () returns the number of milliseconds since January 1, 1970. GetTimezoneOffset () returns the minute difference between local time and Greenwich mean time (GMT). GetUTCDate () returns the day of the month (1-31) from the Date object based on UTC. GetUTCDay () returns the day of the week (0-6) from the Date object based on UTC. GetUTCMonth () returns the month (0-11) from the Date object based on UTC. GetUTCFullYear () returns a four-digit year from the Date object based on UTC. GetUTCHours () returns the hours (0-23) of the Date object based on UTC. GetUTCMinutes () returns the minutes (0-59) of the Date object based on UTC. GetUTCSeconds () returns the seconds of the Date object based on UTC (0-59). GetUTCMilliseconds () returns the milliseconds (0-999) of the Date object based on UTC. Parse () returns the number of milliseconds from midnight on January 1, 1970 to the specified date (string). SetDate () sets the day of the month in the Date object (1-31). SetMonth () sets the month in the Date object (0-11). SetFullYear () sets the year (four digits) in the Date object. Use the setFullYear () method instead of setYear (). SetHours () sets the hour (0-23) in the Date object. SetMinutes () sets the minutes in the Date object (0-59). SetSeconds () sets the seconds in the Date object (0-59). SetMilliseconds () sets the milliseconds (0-999) in the Date object. SetTime () sets the Date object in milliseconds. SetUTCDate () sets the day of the month in the Date object (1-31) based on UTC. SetUTCMonth () sets the month (0-11) in the Date object based on UTC. SetUTCFullYear () sets the year (four digits) in the Date object based on UTC. SetUTCHours () sets the hour (0-23) in the Date object based on UTC. SetUTCMinutes () sets the minutes (0-59) in the Date object based on universal time. SetUTCSeconds () sets the seconds in the Date object (0-59) based on UTC. SetUTCMilliseconds () sets the milliseconds (0-999) in the Date object based on UTC. ToSource () returns the source code for the object. ToString () converts the Date object to a string. ToTimeString () converts the time portion of the Date object to a string. ToDateString () converts the date portion of the Date object to a string. Use the toUTCString () method instead of toGMTString (). ToUTCString () converts the Date object to a string based on universal time. ToLocaleString () converts the Date object to a string based on the local time format. ToLocaleTimeString () converts the time portion of the Date object to a string based on the local time format. ToLocaleDateString () converts the date portion of the Date object to a string based on the local time format. UTC () returns the number of milliseconds from January 1, 1970 to the specified date, based on UTC. ValueOf () returns the original value of the Date object. At this point, the study of "what are the date-time methods in javascript" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report