I have a database column with the syntax "0000-00-00 00:00:00". In PHP, I would do date ('Ymd H: i: s');
In Ruby, I do
require 'date'
now = DateTime::now()
puts "#{now.year()}-#{now.mon()}-#{now.mday()} #{now.hour()}:#{now.min()}:#{now.sec()}"
Result: "2010-1-5 10: 16: 4" This is not normal. How can I create a "timestring" in the format "0000-00-00 00:00:00"?
Many thanks and best regards
source
share