Guest User

Untitled

a guest
Dec 15th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. require "rubygems"
  2. require "ago"
  3. require "chronic"
  4.  
  5. dif = ( 15 * 60 * 60 )
  6. tf = '%H:%M'
  7. puts "Colombia | Australia"
  8. 0.upto 23 do |n|
  9. if n < 12
  10. l = 'am'
  11. elsif n == 12
  12. l = 'at noon'
  13. else
  14. l = 'pm'
  15. end
  16. time = Chronic.parse( "#{ n } #{ l }" )
  17. ct = time.strftime tf
  18. at = ( time + 15.hours ).strftime tf
  19. puts "#{ ct } | #{ at }"
  20. end
  21.  
  22. # This is the output
  23. Colombia | Australia
  24. 00:00 | 15:00
  25. 01:00 | 16:00
  26. 02:00 | 17:00
  27. 03:00 | 18:00
  28. 04:00 | 19:00
  29. 05:00 | 20:00
  30. 06:00 | 21:00
  31. 07:00 | 22:00
  32. 08:00 | 23:00
  33. 09:00 | 00:00
  34. 10:00 | 01:00
  35. 11:00 | 02:00
  36. 12:00 | 03:00
  37. 13:00 | 04:00
  38. 14:00 | 05:00
  39. 15:00 | 06:00
  40. 16:00 | 07:00
  41. 17:00 | 08:00
  42. 18:00 | 09:00
  43. 19:00 | 10:00
  44. 20:00 | 11:00
  45. 21:00 | 12:00
  46. 22:00 | 13:00
  47. 23:00 | 14:00
Add Comment
Please, Sign In to add comment