title: How to use Rails date helper methods outside of Rails?
body: <p>I am converting some Rails controller code to be generic Ruby code. I came across this:</p>
  <pre><code>expiration_date = 1.hours.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z')
  </code></pre>
  <p>...and realized this is not standard Ruby. I get this error message:</p>
  <pre><code>undefined method `hours' for 1:Fixnum (NoMethodError)
  </code></pre>
  <p>How can I convert this to standard Ruby, or require/include the necessary libraries to make this work?</p>
  <h2>Solution:</h2>
  <p>Require the <a href="https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/numeric/time.rb" rel="noreferrer">ActiveSupport Numeric class extensions</a>:</p>
  <pre><code>require 'rubygems'
  require 'active_support/core_ext/numeric/time'
  </code></pre>