2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

`01:20:30.456`な感じの時間の文字列の差分を求める方法

Posted at
require "time"
t = Time.parse("02:09:25.720") - Time.parse("01:06:35.420")
p Time.at(t).utc.strftime("%H:%M:%S.%L")

な感じで。

require "time" がないと Time.parse が使えません。
Time.utc を呼び出しとかないと local time が呼ばれるので +9:00 されてしまいます。
★ 直接 at で gm の時間を呼び出すことはできないのでしょうか?

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?