Class: Date
- Inherits:
-
Object
- Object
- Date
- Defined in:
- lib/casual_support/date/to_ymd.rb
Instance Method Summary collapse
-
#to_ymd ⇒ String
Formats date as “YYYY-MM-DD” (e.g. “1999-12-31”).
Instance Method Details
#to_ymd ⇒ String
Formats date as “YYYY-MM-DD” (e.g. “1999-12-31”). Shortcut for strftime(“%Y-%m-%d”).
9 10 11 12 13 14 |
# File 'lib/casual_support/date/to_ymd.rb', line 9 def to_ymd # Date#strftime appears to be **much** faster than Time#strftime # (nearly 3x faster!). Thus it used here, unlike Time#to_ymd which # uses sprintf. self.strftime('%Y-%m-%d'.freeze) end |