Last active
August 29, 2015 14:07
-
-
Save mihael/9f18e9d3d9521e455696 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
#!/usr/bin/env ruby | |
require 'active_support/time' | |
require 'ice_cube' | |
#monthly on the 1st | |
rule = IceCube::Rule.monthly.day_of_month(1) | |
#UTC | |
utc_start = Time.new(2002, 10, 1, 4, 55, 0, "+00:00") | |
s_UTC = IceCube::Schedule.new(utc_start) | |
s_UTC.add_recurrence_rule(rule) | |
puts "UTC start: #{utc_start}, next_occurrence: #{s_UTC.next_occurrence(utc_start)}" | |
#GMT | |
gmt_start = Time.new(2002, 9, 30, 23, 55, 0, "-05:00") | |
s_GMT = IceCube::Schedule.new(gmt_start) | |
s_GMT.add_recurrence_rule(rule) | |
puts "GMT start: #{gmt_start}, next_occurrence: #{s_GMT.next_occurrence(gmt_start)}" | |
puts "GMT in UTC : #{gmt_start}.utc => #{gmt_start.utc}" | |
puts "UTC in GMT: #{utc_start}.in_time_zone() => #{utc_start.in_time_zone('EST')}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment