Class: DateTime

Inherits:
Object
  • Object
show all
Defined in:
lib/date_time_extensions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.beginning_ofObject



3
4
5
# File 'lib/date_time_extensions.rb', line 3

def self.beginning_of
  DateTime.parse( "0000-01-01T00:00:00+00:00" )
end

.end_ofObject



7
8
9
# File 'lib/date_time_extensions.rb', line 7

def self.end_of
  DateTime.parse( "9999-12-31T00:00:00+00:00" )
end

Instance Method Details

#time?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/date_time_extensions.rb', line 11

def time?
  return !(hour == 0 && min == 0 && sec == 0 && sec_fraction == 0)
end

#to_standard_sObject



15
16
17
# File 'lib/date_time_extensions.rb', line 15

def to_standard_s
  return time? ? strftime( "%B %d, %Y %I:%M %p" ) : to_date.to_standard_s
end