Class: DateTime
- Inherits:
-
Object
- Object
- DateTime
- Defined in:
- lib/ferret/number_tools.rb
Instance Method Summary collapse
-
#to_s_lex(precision = :day) ⇒ Object
Convert the DateTime to a lexicographically sortable string with the required precision.
Instance Method Details
#to_s_lex(precision = :day) ⇒ Object
Convert the DateTime to a lexicographically sortable string with the required precision. The format used is %Y%m%d %H:%M:%S.
- precision
-
the precision required in the string version of the date. The options are :year, :month, :day, :hour, :minute and :second
- return
-
a lexicographically sortable string representing the date
84 85 86 |
# File 'lib/ferret/number_tools.rb', line 84 def to_s_lex(precision = :day) self.strftime(Time::LEX_FORMAT[precision]) end |