JS时间日期方法有哪些


今天小编给大家分享一下JS时间日期方法有哪些的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。Date 对象用于处理日期和时间。日期对象是用new Date().实例化日期有四种方式:getDate()Returns the day of the month (from 1-31)getDay()Returns the day of the week (from 0-6)getFullYear()Returns the yeargetHours()Returns the hour (from 0-23)getMilliseconds()Returns the milliseconds (from 0-999)getMinutes()Returns the minutes (from 0-59)getMonth()Returns the month (from 0-11)getSeconds()Returns the seconds (from 0-59)getTime()Returns the number of milliseconds since midnight Jan 1 1970, and a specified dategetTimezoneOffset()Returns the time difference between UTC time and local time, in minutesgetUTCDate()Returns the day of the month, according to universal time (from 1-31)getUTCDay()Returns the day of the week, according to universal time (from 0-6)getUTCFullYear()Returns the year, according to universal timegetUTCHours()Returns the hour, according to universal time (from 0-23)getUTCMilliseconds()Returns the milliseconds, according to universal time (from 0-999)getUTCMinutes()Returns the minutes, according to universal time (from 0-59)getUTCMonth()Returns the month, according to universal time (from 0-11)getUTCSeconds()Returns the seconds, according to universal time (from 0-59)getYear()Deprecated. Use the getFullYear() method insteadnow()Returns the number of milliseconds since midnight Jan 1, 1970parse()Parses a date string and returns the number of milliseconds since January 1, 1970setDate()Sets the day of the month of a date objectsetFullYear()Sets the year of a date objectsetHours()Sets the hour of a date objectsetMilliseconds()Sets the milliseconds of a date objectsetMinutes()Set the minutes of a date objectsetMonth()Sets the month of a date objectsetSeconds()Sets the seconds of a date objectsetTime()Sets a date to a specified number of milliseconds after/before January 1, 1970setUTCDate()Sets the day of the month of a date object, according to universal timesetUTCFullYear()Sets the year of a date object, according to universal timesetUTCHours()Sets the hour of a date object, according to universal timesetUTCMilliseconds()Sets the milliseconds of a date object, according to universal timesetUTCMinutes()Set the minutes of a date object, according to universal timesetUTCMonth()Sets the month of a date object, accor免费云主机域名ding to universal timesetUTCSeconds()Set the seconds of a date object, according to universal timesetYear()Deprecated. Use the setFullYear() method insteadtoDateString()Converts the date portion of a Date object into a readable stringtoGMTString()Deprecated. Use the toUTCString() method insteadtoISOString()Returns the date as a string, using the ISO standardtoJSON()Returns the date as a string, formatted as a JSON datetoLocaleDateString()Returns the date portion of a Date object as a string, using locale conventionstoLocaleTimeString()Returns the time portion of a Date object as a string, using locale conventionstoLocaleString()Converts a Date object to a string, using locale conventionstoString()Converts a Date object to a stringtoTimeString()Converts the time portion of a Date object to a stringtoUTCString()Converts a Date object to a string, according to universal timeUTC()Returns the number of milliseconds in a date since midnight of January 1, 1970, according to UTC timevalueOf()Returns the primitive value of a Date objectconstructorprototype以上就是“JS时间日期方法有哪些”这篇文章的所有内容,感谢各位的阅读!相信大家阅读完这篇文章都有很大的收获,小编每天都会为大家更新不同的知识,如果还想学习更多的知识,请关注百云主机行业资讯频道。

相关推荐: 如何用Golang可选参数实现可选模式

本文小编为大家详细介绍“如何用Golang可选参数实现可选模式”,内容详细,步骤清晰,细节处理妥当,希望这篇“如何用Golang可选参数实现可选模式”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。可选参数给函数传递额外参数扩展或修改其…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

(0)
打赏 微信扫一扫 微信扫一扫
上一篇 04/03 15:41
下一篇 04/03 15:41

相关推荐