I'd like to save apache logs to MySQL via ActiveRecord. In the apache log, the default time string is like:
[13/Aug/2008:00:50:49 -0700]
How can I convert it to a ActiveRecord :datetime
type? Thanks!
apache_time = "[13/Aug/2008:00:50:49 -0700]"
d = DateTime.strptime( apache_time, "[%d/%b/%Y:%H:%M:%S %Z]")
The format string is documented here: http://ruby-doc.org/core/classes/Time.src/M000298.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With