Forum: Ruby on Rails mySQL 5.0 upgrade - incompatible DateTime format?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
steve.enzer (Guest)
on 2005-11-21 01:40
(Received via mailing list)
I've upgraded to mySQL 5.0, and it's gone pretty smoothly except that on
DateTime.now doesn't seem to return a value that mySQL likes any more,
as seen in the following exception:

   Incorrect datetime value: '2005-11-20T15:33:12-0800' for column
'logged_at' at row 1: UPDATE notes SET `due_on` = '2005-11-20',
`created_at` = '2005-11-20 15:33:12', `deleted` = 0, `user_name` =
'steve', `labels` = NULL, `job_name` = NULL, `domain_controller` = NULL,
`domain_id` = NULL, `contact_name` = NULL, `customer_id` = NULL,
`logged_at` = '2005-11-20T15:33:12-0800', `user_id` = 2, `is_log` = 0,
`contact_id` = NULL, `vendor_id` = NULL, `job_id` = NULL, `subject` =
'test', `customer_name` = NULL WHERE id = 8

what is that strange datetime value, anyway? the
one it's trying to store looks like this:

'2005-11-20T15:33:12-0800'

the DateTime that Rails generates automatically for updated_at looks
like this:

 '2005-11-20 15:33:12'


Does anyone know what's going on here?
I've searched and have come up with zilch so far.
christopher.k.hall (Guest)
on 2005-11-21 14:34
(Received via mailing list)
that looks like a iso8601 date string. i think there were some problems
with
iso8601 formatted dates and mysql5...you'll have to check the mysql
buglist
to be certain. in the meantime, you can do:

DateTime.now.strftime("%Y-%m-%d %H:%M:%S") # returns a string formatted
as
"2005-11-21 07:26:00"

or

Time.now.strftime("%Y-%m-%d %H:%M:%S")
This topic is locked and can not be replied to.