首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

JavaScript Date对象步骤

2012-11-22 
JavaScript Date对象方法Date Object Methods日期对象方法FF: Firefox, N: Netscape, IE: Internet Explor

JavaScript Date对象方法

Date Object Methods日期对象方法FF: Firefox, N: Netscape, IE: Internet ExplorerFF:火狐,N:网景,IEMethod方法Description描述FFNIEDate()Returns today's date and time返回今天的日期和时间getDate()Returns the day of the month from a Date object (from 1-31)返回月中的第几天(1到31)getDay()Returns the day of the week from a Date object (from 0-6)返回一周中的第几天(0到6)getMonth()Returns the month from a Date object (from 0-11)返回月份数(0到11)getFullYear()Returns the year, as a four-digit number, from a Date object返回完整的年份数getYear()Returns the year, as a two-digit or a four-digit number, from a Date object. Use getFullYear() instead !!返回年份,可以是两位的或是四位的getHours()Returns the hour of a Date object (from 0-23)返回日期对象的小时数(0到23)getMinutes()Returns the minutes of a Date object (from 0-59)返回日期对象的分钟(0到59)getSeconds()Returns the seconds of a Date object (from 0-59)返回日期对象的秒(0到59)getMilliseconds()Returns the milliseconds of a Date object (from 0-999)返回毫秒(0到999)getTime()Returns the number of milliseconds since midnight Jan 1, 1970从1970年1月1号午夜到现在一共花去的毫秒数getTimezoneOffset()Returns the difference in minutes between local time and Greenwich Mean Time (GMT)本地时间和GMT相差多少分钟getUTCDate()Returns the day of the month from a Date object according to universal time (from 1-31)依据国际时间来得到月中的第几天(1到31)getUTCDay()Returns the day of the week from a Date object according to universal time (from 0-6)依据国际时间来得到现在是星期几(0到6)getUTCMonth()Returns the month from a Date object according to universal time (from 0-11)依据国际时间来得到月份(0到11)getUTCFullYear()Returns the four-digit year from a Date object according to universal time依据国际时间来得到完整的年份getUTCHours()Returns the hour of a Date object according to universal time (from 0-23)依据国际时间来得到小时(0-23)getUTCMinutes()Returns the minutes of a Date object according to universal time (from 0-59)依据国际时间来返回分钟(0到59)getUTCSeconds()Returns the seconds of a Date object according to universal time (from 0-59)依据国际时间来返回秒(0到59)getUTCMilliseconds()Returns the milliseconds of a Date object according to universal time (from 0-999)依据国际时间来返回毫秒(0到999)parse()Takes a date string and returns the number of milliseconds since midnight of January 1, 1970或得并返回自1970年1月1号凌晨到现在一共花掉了多少毫秒setDate()Sets the day of the month in a Date object (from 1-31)设置日setMonth()Sets the month in a Date object (from 0-11)设置月setFullYear()Sets the year in a Date object (four digits)设置年份setYear()Sets the year in the Date object (two or four digits). Use setFullYear() instead !!用setFullYear()来取代setHours()Sets the hour in a Date object (from 0-23)设置小时setMinutes()Set the minutes in a Date object (from 0-59)设置分钟setSeconds()Sets the seconds in a Date object (from 0-59)设置秒setMilliseconds()Sets the milliseconds in a Date object (from 0-999)设置毫秒setTime()Calculates a date and time by adding or subtracting a specified number of milliseconds to/from midnight January 1, 1970123setUTCDate()Sets the day of the month in a Date object according to universal time (from 1-31)依据国际时间来设置日期setUTCMonth()Sets the month in a Date object according to universal time (from 0-11)依据国际时间来设置月setUTCFullYear()Sets the year in a Date object according to universal time (four digits)依据国际时间来设置年份setUTCHours()Sets the hour in a Date object according to universal time (from 0-23)依据国际时间来设置小时setUTCMinutes()Set the minutes in a Date object according to universal time (from 0-59)依据国际时间来设置分钟setUTCSeconds()Set the seconds in a Date object according to universal time (from 0-59)依据国际时间来设置秒setUTCMilliseconds()Sets the milliseconds in a Date object according to universal time (from 0-999)依据国际时间来设置毫秒toSource()Represents the source code of an object显示对象的源代码toString()Converts a Date object to a string将日期对象转换为字符串toGMTString()Converts a Date object, according to Greenwich time, to a string. Use toUTCString() instead !!根据格林威治时间将Date[日期]对象转换为一个字符串。可以使用toUTCString()替代这种方法toUTCString()Converts a Date object, according to universal time, to a string根据通用时间将一个Date[日期]对象转换为一个字符串toLocaleString()Converts a Date object, according to local time, to a string根据本地时间将一个Date[日期]对象转换为一个字符串UTC()Takes a date and returns the number of milliseconds since midnight of January 1, 1970 according to universal time根据通用时间将日期计算为从1970年1月1日午夜至今所经过的时间(单位:毫秒)valueOf()Returns the primitive value of a Date object返回日期对象的原始值
?

热点排行