OnTime
OnTime is a dependency-less, thread-safe, and fluent way to create times in ruby.
Installation
Add this line to your application's Gemfile:
gem 'ontime'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ontime
Usage
On.January(3.rd)
On.March(24.th, 2007)
On.December(2.nd, 2008).at(1).pm
On.April(1.st).at('2:38').am
On.August(13.th).at('4:30').pm.and(56.seconds)
On.the(4.th).of(:July, 2015).at(2).pm.in('US/Pacific')
On.the(7.th).at(:midnight)
On.September(19.th).at(:midday).in('UTC')
Method | Description |
---|
to_time | Converts the resulting OnTime object to a native ruby Time object |
month | Returns the month as an integer (1-12) |
date | Returns the day as an integer (1-31) |
year | Returns the year as an integer (ex. 2007) |
hour | Returns the hour as an integer (0-23) |
min | Returns the minutes as an integer (0-59) |
sec | Returns the seconds as an integer (0-60) |
offset | Returns the timezone offset as a string (+/-HHMM, ex. -0600) |
Contributing
- Fork it (https://github.com/nathanielwroblewski/ontime/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request