Coffeescript-date-getminutes

提供:Dev Guides
移動先:案内検索

CoffeeScript Date-getMinutes()

説明

  • getMinutes()*メソッドは、現地時間に従って指定された日付の分を返します。 getMinutes()によって返される値は、0〜59の整数です。

構文

以下に、* getMinutes()*メソッドの構文を示します。

Date.getMinutes()

次の例は、CoffeeScriptでの* getMinutes()メソッドの使用法を示しています。 このコードを *date_getminutes.coffee という名前のファイルに保存します。

dt = new Date "February 19, 2016 23:15:25:22"
console.log "The value of the minutes in the specified date is : " + dt.getMinutes()
  • コマンドプロンプト*を開き、以下に示すように.coffeeファイルをコンパイルします。
c:\> coffee -c date_getminutes.coffee

コンパイル時に、次のJavaScriptが提供されます。

//Generated by CoffeeScript 1.10.0
(function() {
  var dt;

  dt = new Date("February 19, 2016 23:15:25:22");

  console.log("The value of the minutes in the specified date is : " + dt.getMinutes());

}).call(this);

次に、*コマンドプロンプト*を再度開き、以下に示すようにCoffeeScriptファイルを実行します。

c:\> coffee date_getminutes.coffee

CoffeeScriptファイルを実行すると、次の出力が生成されます。

The value of the minutes in the specified date is : 15