Connect IQ > APIメモ > Toybox > Time > Moment

下位ページ

Content

Class: Toybox::Time::Moment

Moment オブジェクトは不変の時刻を表現する。内部的には UNIX epoch からの経過秒を 32 ビット整数値として保持している。この値を時刻に変換する方法として、例えば次の方法がある。
  1. Time.Gregorian.infoの関数で、Gregorian.Info オブジェクトを取得
  2. Infoオブジェクトから時分秒を取得

  • Since : 1.0.0

関数(要約)

  • (Moment) add(time) : Duration を Moment に加える
  • (Number) compare(date) : Use compare() to determine if a Moment is before or after another Moment.
  • (Boolean) greaterThan(date) : ある Moment が別の Moment 値より大きいか判定する
  • (Moment) initialize(value) constructor : A new instance of Moment.
  • (Boolean) lessThan(date) : ある Moment が別の Moment 値より小さいか判定する
  • (Duration) subtract(date) 2つの Moment の値の差分を計算する
  • (Number) value : Get the UTC value of this date with value().

Constructor Details

(Moment) initialize(value) : 新しい Moment オブジェクトを返す。

  • Parameters
    • value : (Number) [sec]?
  • Since : 1.1.2

Instance Method Details

(Moment) add(time) : Duration を Moment に加える

  • Parameters
    • time (Duration) : Duration delta to add to Moment
  • Returns : (Moment) The result of Moment + Duration
  • Since : 1.0.0

(Number) compare(date)

Use compare() to determine if a Moment is before or after another Moment.
  • Parameters
    • date (Moment) : Moment object to compare to this Moment
  • Returns : (Number) Negative if this < that, positive if this > that, 0 if this == that
  • Since : 1.0.0

(Boolean) greaterThan(date) : ある Moment が別の Moment 値より大きいか判定する

  • Parameters
    • date (Moment) : Moment object to compare to this Moment
  • Returns : (Boolean) true if this is greater than that, false otherwise
  • Since : 1.0.0

(Boolean) lessThan(date) : ある Moment が別の Moment 値より小さいか判定する

  • Parameters
    • date (Moment) : Moment object to compare to this Moment
  • Returns : (Boolean) true if this is less than that, false otherwise
  • Since : 1.0.0

(Duration) subtract(date) : 2つの Moment の値の差分を計算する

  • Parameters
    • date (Moment) : Moment object used to find delta
  • Returns : (Duration) Delta between date and the Moment object
  • Since : 1.0.0

(Number) value : UTC値を取得する

  • Returns : (Number) UTC date in seconds since UNIX epoch
  • Since : 1.0.0
最終更新:2016年03月12日 22:25