Created
June 28, 2014 20:07
-
-
Save bradpauly/9a9aed40219fff0d2b90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Search all zones for 8:00am. | |
(0..23).each do |hour| | |
[0, 15, 30, 45].each do |minute| | |
utc_time_to_check = Time.utc(2014, 6, 28, hour, minute, 0) | |
TZInfo::Timezone.all_identifiers.each do |zone_name| | |
local_tz = TZInfo::Timezone.get(zone_name) | |
local_time = local_tz.utc_to_local(utc_time_to_check).to_datetime | |
if local_time.minute == 0 && local_time.hour == 8 | |
puts utc_time_to_check.strftime("%H:%M") + ' UTC => ' + local_time.strftime("%H:%M") + ' in ' + zone_name | |
end | |
end | |
end | |
end | |
# Check non-zero minute offsets. | |
(0..23).each do |hour| | |
[0, 15, 30, 45].each do |minute| | |
utc_time_to_check = Time.utc(2014, 6, 28, hour, minute, 0) | |
TZInfo::Timezone.all_identifiers.each do |zone_name| | |
local_tz = TZInfo::Timezone.get(zone_name) | |
local_time = local_tz.utc_to_local(utc_time_to_check).to_datetime | |
if local_time.minute == 0 && local_time.hour == 8 && minute > 0 | |
puts utc_time_to_check.strftime("%H:%M") + ' UTC => ' + local_time.strftime("%H:%M") + ' in ' + zone_name | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment