Method: Time#formatted
- Defined in:
- lib/openc3/core_ext/time.rb
#formatted(include_year = true, fractional_digits = 3, include_utc_offset = false) ⇒ String
Returns Date formatted as YYYY/MM/DD HH:MM:SS.US UTC_OFFSET.
253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/openc3/core_ext/time.rb', line 253 def formatted(include_year = true, fractional_digits = 3, include_utc_offset = false) str = "" str << "%Y/%m/%d " if include_year str << "%H:%M:%S" str << ".%#{fractional_digits}N" if fractional_digits > 0 if include_utc_offset if self.utc? str << " UTC" else str << " %z" end end self.strftime(str) end |