I’ve been struggling with something that is probably very simple.
I need to save an entry from an atom feed that has a datetime string
like this:
2010-07-20T11:49:19.000Z
which is an XMLSchema date time.
I’ve tried many variations around:
glog.elements.each(“published”) do |element| @snapshot.entrycreated =
Time.xmlschema(element.text).to_s(:db)
end
If I save that to a regular string I get what looks correct to me:
“2010-07-20 11:49:19”
but saved in the entrycreated column it outputs as: “Sat Jan 01
11:49:19 UTC 2000”
Can anyone help me with the correct code to save this datetime
correctly pleased.
In case it’s relevant, on my dev machine I have sqlite. Eventually it
will be on mysql.
Thanks for any help,
Steve
If I save that to a regular string I get what looks correct to me:
“2010-07-20 11:49:19”
but saved in the entrycreated column it outputs as: “Sat Jan 01
11:49:19 UTC 2000”
Is you entrycreated column a time column ? Time columns only save a
time of day (and ignore the date), what you want is a datetime column.
If I save that to a regular string I get what looks correct to me:
“2010-07-20 11:49:19”
but saved in the entrycreated column it outputs as: “Sat Jan 01
11:49:19 UTC 2000”