rtacconi
rtacconi

Reputation: 14789

Ruby convert Mysql timestamp to Mysql datetime

I am trying to import data from a DB to another. The source DB has TIMESTAMP (mysql) the destination has DATETIME (mysql). I am trying something like that:

start_at = DateTime.at(row['QA_CONF_START_STAMP']) #start_at

But it is not working

Upvotes: 1

Views: 965

Answers (1)

tadman
tadman

Reputation: 211740

I'm not sure if conversion is expressly required in this case, as the two values should be equivalent.

Since you're not retrieving the original data using a model, it's coming through as a raw string. The easiest way to interpret that is:

DateTime.parse(row['QA_CONF_START_STAMP'])

Upvotes: 1

Related Questions