Coffeescript-date-getutcmilliseconds
提供:Dev Guides
CoffeeScript Date-getUTCMilliseconds()
説明
- getUTCMilliseconds()*メソッドは、世界時に従って指定された日付のミリ秒を返します。 getUTCMilliseconds()によって返される値は、0〜999の整数です。
構文
以下に、* getUTCMilliseconds()*メソッドの構文を示します。
Date.getUTCMilliseconds()
例
次の例は、CoffeeScriptでの* getUTCMilliseconds()メソッドの使用法を示しています。 このコードを *date_getutcmilliseconds.coffee という名前のファイルに保存します。
dt = new Date()
console.log "The UTC milliseconds in the specified date is : " + dt.getUTCMilliseconds()
- コマンドプロンプト*を開き、以下に示すように.coffeeファイルをコンパイルします。
c:\> coffee -c date_getutcmilliseconds.coffee
コンパイル時に、次のJavaScriptが提供されます。
//Generated by CoffeeScript 1.10.0
(function() {
var dt;
dt = new Date();
console.log("The UTC milliseconds in the specified date is : " + dt.getUTCMilliseconds());
}).call(this);
次に、*コマンドプロンプト*を再度開き、以下に示すようにCoffeeScriptファイルを実行します。
c:\> coffee date_getutcmilliseconds.coffee
CoffeeScriptファイルを実行すると、次の出力が生成されます。
The UTC milliseconds in the specified date is : 22