`
stephen830
  • 浏览: 2968090 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

JavaScript Date 对象参考手册 getUTCFullYear() 方法

阅读更多

JavaScript getUTCFullYear() 方法

定义和用法

getUTCFullYear() 方法可返回根据世界时 (UTC) 表示的年份的四位数字。

语法

dateObject.getUTCFullYear()

 

返回值

返回 dateObject 用世界时表示时的年份,该值是一个四位的整数,而不是两位数的缩写。

提示和注释:

注释:该方法总是结合一个 Date 对象来使用。

 

提示:有关通用协调时间 (UTC) 的更多资料,请参阅这里

 

实例

例子 1

在这个例子中将获取当前的UTC年份,并且打印输出:

<script type="text/javascript">

var d = new Date()
document.write(d.getUTCFullYear())

</script>

 

 

输出:

2009

 

例子 2

Here we will extract the year out of the specific date:

<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write("I was born in " + born.getUTCFullYear())

</script>

 

 

输出:

I was born in 1983

 

 

 

分享到:
评论

相关推荐

    简介JavaScript中的getUTCFullYear()方法的使用

    按照通用时间在指定日期,javascript Date.getUTCFullYear()方法返回的年度。通过getUTCFullYear返回的值是一个绝对数字是符合2000年的,例如,2008年。 语法 Date.getUTCFullYear() 下面是参数的详细信息: NA ...

    微软JavaScript手册

    getUTCFullYear 方法 使用全球标准时间(UTC)返回 Date 对象的年份。 getUTCHours 方法 使用全球标准时间(UTC)返回Date 对象的小时数。 getUTCMilliseconds 方法 使用全球标准时间(UTC)返回Date 对象的毫秒数...

    Javascript的getYear、getFullYear、getUTCFullYear异同分享

    getYear、getFullYear、getUTCFullYear都是Javascript的Date对象的方法函数

    javascript语言参考+教程 CHM

    getUTCFullYear 方法; getUTCHours 方法; getUTCMilliseconds 方法; getUTCMinutes 方法; getUTCMonth 方法; getUTCSeconds 方法; getVarDate 方法; getYear 方法; indexOf 方法; isFinite 方法; isNaN ...

    javascript文档

    getUTCFullYear 方法 使用全球标准时间(UTC)返回 Date 对象的年份。 getUTCHours 方法 使用全球标准时间(UTC)返回Date 对象的小时数。 getUTCMilliseconds 方法 使用全球标准时间(UTC)返回Date 对象的毫秒数...

    JScript 语言参考

    getUTCFullYear 方法 使用全球标准时间(UTC)返回 Date 对象的年份。 getUTCHours 方法 使用全球标准时间(UTC)返回Date 对象的小时数。 getUTCMilliseconds 方法 使用全球标准时间(UTC)返回Date 对象的毫秒数...

    JavaScript权威指南

    JavaScript权威指南 犀牛书 Chapter 1. Introduction to JavaScript Section 1.1. JavaScript Myths Section 1.2. Versions of JavaScript Section 1.3. Client-Side JavaScript Section 1.4. JavaScript ...

    Prototype Date对象 学习

    看一下源码: 代码如下: Date.prototype.toJSON = function() { return ‘”‘ + this.getUTCFullYear() + ‘-‘ + (this.getUTCMonth() + 1).toPaddedString(2) + ‘-‘ + this.getUTCDate().toPaddedString(2) + ...

    IE6-8中Date不支持toISOString的修复方法

    Date.prototype.toISOString方法是在ES5里添加的,ES3文档中没有,如下 这个方法在IE6/7/8中不支持,可按下面方式修复下 代码如下: if (!Date.prototype.toISOString) { Date.prototype.toISOString = function() { ...

    json.js_json2.js

    return this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z'; ...

    flash action script 经典字典教程大全,学flash必备

    getUTCFullYear Date.getUTCFullYear() getUTCHours Date.getUTCHours() getUTCMilliseconds Date.getUTCMilliseconds() getUTCMinutes Date.getUTCMinutes() getUTCMonth Date.getUTCMonth() ...

Global site tag (gtag.js) - Google Analytics