Class: DateTime
- Includes:
- QuarterStrMethods
- Defined in:
- lib/ruby-rails-extensions/extensions/input.rb,
lib/ruby-rails-extensions/extensions/in_utc.rb,
lib/ruby-rails-extensions/extensions/to_local.rb,
lib/ruby-rails-extensions/extensions/current_day.rb,
lib/ruby-rails-extensions/extensions/day_of_week.rb,
lib/ruby-rails-extensions/extensions/quarter_str.rb,
lib/ruby-rails-extensions/extensions/current_week.rb,
lib/ruby-rails-extensions/extensions/display_user.rb,
lib/ruby-rails-extensions/extensions/current_month.rb,
lib/ruby-rails-extensions/extensions/google_format.rb,
lib/ruby-rails-extensions/extensions/display_military.rb
Instance Method Summary collapse
-
#current_day ⇒ Object
:nodoc:.
-
#current_month ⇒ Object
:nodoc:.
- #current_week ⇒ Object
-
#day_of_week ⇒ String
-
Full day word.
-
- #display_military(all = false) ⇒ String
-
#display_user(all = false) ⇒ String
-
mm/dd/yyyy HH:MM:SS AM/PM or m/d/yy HH:MM:SS AM/PM.
-
-
#google_format ⇒ String
Yyyy-mm-ddThh:mm:ss+hhmm.
- #in_utc ⇒ DateTime
- #input(all = false) ⇒ String
-
#to_local ⇒ DateTime
Converts to an Eastern time zone.
Methods included from QuarterStrMethods
Instance Method Details
#current_day ⇒ Object
:nodoc:
7 8 9 |
# File 'lib/ruby-rails-extensions/extensions/current_day.rb', line 7 def current_day beginning_of_day..end_of_day end |
#current_month ⇒ Object
:nodoc:
7 8 9 |
# File 'lib/ruby-rails-extensions/extensions/current_month.rb', line 7 def current_month beginning_of_month..end_of_month end |
#current_week ⇒ Object
7 8 9 |
# File 'lib/ruby-rails-extensions/extensions/current_week.rb', line 7 def current_week beginning_of_week..end_of_week end |
#day_of_week ⇒ String
Returns - Full day word.
7 8 9 |
# File 'lib/ruby-rails-extensions/extensions/day_of_week.rb', line 7 def day_of_week strftime('%A') end |
#display_military(all = false) ⇒ String
7 8 9 |
# File 'lib/ruby-rails-extensions/extensions/display_military.rb', line 7 def display_military(all = false) strftime(all ? '%m/%d/%Y %T' : '%-m/%-d/%y %T') end |
#display_user(all = false) ⇒ String
Returns - mm/dd/yyyy HH:MM:SS AM/PM or m/d/yy HH:MM:SS AM/PM.
7 8 9 |
# File 'lib/ruby-rails-extensions/extensions/display_user.rb', line 7 def display_user(all = false) strftime(all ? '%m/%d/%Y %r' : '%-m/%-d/%y %r') end |
#google_format ⇒ String
Returns yyyy-mm-ddThh:mm:ss+hhmm.
7 8 9 |
# File 'lib/ruby-rails-extensions/extensions/google_format.rb', line 7 def google_format strftime('%FT%T%z') end |
#in_utc ⇒ DateTime
7 8 9 |
# File 'lib/ruby-rails-extensions/extensions/in_utc.rb', line 7 def in_utc utc? ? self : new_offset(0) end |
#input(all = false) ⇒ String
Returns - yyyy-mm-dd.
7 8 9 |
# File 'lib/ruby-rails-extensions/extensions/input.rb', line 7 def input(all = false) strftime(all ? '%F %T' : '%F') end |
#to_local ⇒ DateTime
Converts to an Eastern time zone
18 19 20 |
# File 'lib/ruby-rails-extensions/extensions/to_local.rb', line 18 def to_local in_time_zone(RubyRailsExtensions.configuration.default_time_zone || 'Eastern Time (US & Canada)').to_datetime end |