- Notifications
You must be signed in to change notification settings - Fork99
Closed
Description
Timezone#strftime("%s", time) converts the given time to UNIX time. Because UNIX time is the number of seconds that have elapsed since 1970-01-01 00:00:00 (UTC), the result does not depends on the timezone.
However, the result of the folloing code seems incorrect.
#!/usr/bin/rubyrequire'tzinfo'jst=TZInfo::Timezone.get("Japan")utc=TZInfo::Timezone.get("UTC")time=Time.now.utcputsjst.strftime("%F %T (%Z): %s",time)putsutc.strftime("%F %T (%Z): %s",time)
The code returned:
2018-08-30 21:18:23 (JST): 15356639032018-08-30 12:18:23 (UTC): 1535631503In the case above, I expecet the result as:
2018-08-30 21:18:23 (JST): 15356315032018-08-30 12:18:23 (UTC): 1535631503I used tzinfo-1.2.3 with Ruby 2.3.
Metadata
Metadata
Assignees
Labels
No labels