adzap / timeliness

Fast date/time parsing for the control freak.
http://github.com/adzap/timeliness
MIT License
224 stars 28 forks source link

Output Format - Doc Clarity Issue #24

Closed dmc2015 closed 5 years ago

dmc2015 commented 7 years ago

This looks like a great gem. I am trying to understand the documentation though.

Per the doc:

Timeliness.parse('2010-09-08 12:13:14') #=> Wed Sep 08 12:13:14 1000 2010

What actually happens:

Timeliness.parse('2010-09-08 12:13:14') #=> 2010-09-08 12:13:14 -0400

It would appear that the format option is for understanding the input, not formatting the output.

Is there a way to do this? I would like to provide an input and then get an output of the specified format like this:

Timeliness.parse('2010-09-08 12:13:14', :format => "yyyy/dd/mm hh:nn:ss") #=> 2010/08/09 12:13:14
adzap commented 7 years ago

Thanks for your interest. This gem has no facility to output to string formats. It only parses strings into Time objects. The format option limits what format the input string should be considered valid. I had always wanted to add an output function using the customisable format tokens the gem allows. Alas I never got there.