Date.prototype.getUTCMilliseconds() - UTCのミリ秒を返す
Date.prototype.getUTCMilliseconds()は、インスタンスから、UTCに従った「ミリ秒」を取得するメソッドです。
概要
- 名前
- getUTCMilliseconds
- 所属
- Date.prototype
- 仕様書
- https://tc39.github.io/ecma262/#sec-date.prototype.getutcmilliseconds
説明
Date.prototype.getUTCMilliseconds ( )
UTCにおけるミリ秒を表す0〜999の数値を返す。
デモ
Date.prototype.getUTCMilliseconds()のデモです。ミリ秒単位の時差というのはないのでLocal timeのミリ秒数(getMilliseconds())と結果は変わりません。
<!-- このコードは編集できます。 -->
<!DOCTYPE html>
<html>
<head>
<style>
body {
white-space: pre-wrap ;
}
</style>
</head>
<body>
<script>
/** try it! **/
var date = new Date( 2017, 4, 10, 8, 10, 30, 15 ) ;
var a = date.getUTCMilliseconds() ; // UTC
var b = date.getMilliseconds() ; // Local time
/** try it! **/
var results = { a:a, b:b, } ;
for( var name in results ) {
console.log( name, results[name] ) ;
document.body.appendChild( new Text( name + " = " + JSON.stringify( results[name] ) + "\n" ) ) ;
}
</script>
</body>
</html>
サポート状況
Chrome | Firefox | Safari | Edge | IE | Opera | iOS Safari | Android |
---|---|---|---|---|---|---|---|
● | ● | ● | ● | ● | ● | ● | ● |
関連記事
- Date.prototype.getMilliseconds()
- Date.prototype.getMilliseconds()は、インスタンスから、Local time(端末の時間設定)に従った「ミリ秒」を取得するメソッドです。
- Date.prototype.setMilliseconds()
- Date.prototype.setMilliseconds()は、インスタンスに、Local time(端末の時間設定)で「ミリ秒」をセットするメソッドです。
- Date.prototype.setUTCMilliseconds()
- Date.prototype.setUTCMilliseconds()は、インスタンスに、UTCで「ミリ秒」をセットするメソッドです。
- Date.prototype.getUTCSeconds()
- Date.prototype.getUTCSeconds()は、インスタンスから、UTCに従った「秒」を取得するメソッドです。