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

下位ページ

Content

Module: Toybox::Time::Gregorian

グレゴリウス暦に基づいてMomentオブジェクトやDurationオブジェクトを取得するためのインターフェースを提供する。
  • Since : 1.0.0

Defined Under Namespace

  • Classes: Info

定数 Gregorian

  • SECONDS_PER_YEAR = 31557600 : Time constant for number of seconds in a year. Since : 1.0.0
  • SECONDS_PER_DAY = 86400 : Time constant for number of seconds in a day. Since : 1.0.0
  • SECONDS_PER_HOUR = 3600 : Time constant for number of seconds in an hour. Since : 1.0.0
  • SECONDS_PER_MINUTE = 60 : Time constant for number of seconds in a minute. Since : 1.0.0

関数(要約) Gregorian

  • (Duration) duration(options) : Duration オブジェクトを生成する。
  • (Info) info(date, format) : Moment オブジェクトから Gregorian.info を取得する
  • (Moment) moment(options) : Momentオブジェクトを生成する。

Instance Method Details

(Duration) duration(options) : Duration オブジェクトを生成する。

  • Parameters
    • options (Dictionary) : Hash table of options
      • :years (Number) — The number of years
      • :days (Number) — The number of days
      • :hours (Number) — The number of hours
      • :minutes (Number) — The number of minutes
      • :seconds (Number) — The number of seconds
  • Returns : (Duration) The Duration object created using the options
  • Since : 1.0.0

var options = { :seconds => 1 / (info.currentSpeed / 1000)}; // キロあたりのペース(秒)を表すハッシュ
var dur = Time.Gregorian.duration( options );


(Info) info(date, format) : Moment オブジェクトから Gregorian.info を取得する

  • Parameters
    • date (Moment) : Moment object to get Info from
    • format (Number) : Time.FORMAT_XXX 定数。下の Returns を参照。
  • Returns : (Info)
    • FORMAT_SHORT : すべての値が整数値で返る。
    • FORMAT_MEDIUM and FORMAT_LONG : 月 (month)/ 日 (day) が文字列で返る。
  • Since : 1.0.0

(Moment) moment(options) : Momentオブジェクトを生成する。

Moment オブジェクトは現在時刻をベースに生成される。例えば、現在時刻が4月1日で、:day の値に 1 を渡せば、Moment オブジェクトでは 4月2日 になる。
  • Parameters
    • options (Dictionary)
      • :year (Number) : 年
      • :month (Number) : 月
      • :day (Number) : 日
      • :hour (Number) : 時
      • :minute (Number) : 分
      • :second (Number) : 秒
  • Returns : (Moment) The Moment object created using the options
  • Since : 1.0.0
最終更新:2016年03月02日 23:50