I have Ruby code that looks vaguely like this.
str = 2010-12-02_12-10-26
puts str
puts DateTime.parse(str, "%Y-%m-%d_%H-%M-%S")
I expected to get the actual time from the parse. Instead, I’m getting output like this…
2010-12-02_12-10-26
2010-12-02T00:00:00+00:00
How do I get the time parsed in as well?
This works:
This example on Codepad.
According to the documentation
parse:And
strptime: