Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "rubygems"
- require "ago"
- require "chronic"
- dif = ( 15 * 60 * 60 )
- tf = '%H:%M'
- puts "Colombia | Australia"
- 0.upto 23 do |n|
- if n < 12
- l = 'am'
- elsif n == 12
- l = 'at noon'
- else
- l = 'pm'
- end
- time = Chronic.parse( "#{ n } #{ l }" )
- ct = time.strftime tf
- at = ( time + 15.hours ).strftime tf
- puts "#{ ct } | #{ at }"
- end
- # This is the output
- Colombia | Australia
- 00:00 | 15:00
- 01:00 | 16:00
- 02:00 | 17:00
- 03:00 | 18:00
- 04:00 | 19:00
- 05:00 | 20:00
- 06:00 | 21:00
- 07:00 | 22:00
- 08:00 | 23:00
- 09:00 | 00:00
- 10:00 | 01:00
- 11:00 | 02:00
- 12:00 | 03:00
- 13:00 | 04:00
- 14:00 | 05:00
- 15:00 | 06:00
- 16:00 | 07:00
- 17:00 | 08:00
- 18:00 | 09:00
- 19:00 | 10:00
- 20:00 | 11:00
- 21:00 | 12:00
- 22:00 | 13:00
- 23:00 | 14:00
Add Comment
Please, Sign In to add comment