2件ヒット
[1-2件を表示]
(0.034秒)
ライブラリ
- ビルトイン (1)
-
json
/ add / time (1)
検索結果
-
Time
# to _ json(*args) -> String (18682.0) -
自身を JSON 形式の文字列に変換して返します。
...す。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
Time.now.to_json # => "{\"json_class\":\"Time\",\"s\":1544968675,\"n\":676167000}"
//}
@see JSON::Generator::GeneratorMethods::Hash#to_json... -
Time
# to _ s -> String (18646.0) -
時刻を文字列に変換した結果を返します。 以下のようにフォーマット文字列を使って strftime を呼び出すのと同じです。
...下のようにフォーマット文字列を使って strftime を呼び出すのと同じです。
//emlist[][ruby]{
t = Time.local(2000,1,2,3,4,5,6)
p t.to_s # => "2000-01-02 03:04:05 +0900"
p t.strftime("%Y-%m-%d %H:%M:%S %z") # => "2000-01-02 03:04:05 +0900"
p......t.utc.to_s # => "2000-01-01 18:04:05 UTC"
p t.strftime("%Y-%m-%d %H:%M:%S UTC") # => "2000-01-01 18:04:05 UTC"
//}
戻り値の文字エンコーディングは Encoding::US_ASCII です。...