Sometimes you need to format a date / time correctly for database querying and sneaked into Rails 2.1 was a really helpful method for doing just that.
Time.now.to_s(:db)
So the above would change Mon Apr 20 16:15:00 +0100 2009 to "2009-04-20 16:15:00".
Comments left...
Thanks, it was helpful.
Waqas at 22 Jul 10 at 06:13
Articles Archive →
Got something to say?