Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#Ruby or #Rails で unixtimestamp の数値を Time.zone の日時に変換する #2937

Open
YumaInaura opened this issue Jan 12, 2020 · 0 comments

Comments

@YumaInaura
Copy link
Owner

In Ruby need require

 require 'active_support/core_ext'

Time

Time.at(1580655600)
# => 2020-02-02 15:00:00 +0000

Timezone UTC

Time.use_zone('UTC') { Time.zone.at(1580655600) }
# => Sun, 02 Feb 2020 15:00:00 UTC +00:00

Timezone JST

Time.use_zone('Tokyo') { Time.zone.at(1580655600) }
# => Mon, 03 Feb 2020 00:00:00 JST +09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant