I have an old site which has been upgraded. The event content type has a date field on it which uses the Datestamp storage mechanism. I would like to move away from this and switch to Datetime instead. I can create a new field and adjust the views, but I am wondering if there is an easy way to pull in the values from the existing Datestamp entries. Is there an easy way to do this with a MySQL query?

Thanks ...

Comments

OpenChimp’s picture

The FROM_UNIXTIME function looks like it should help. The following query seems to do the format conversion that I need.

SELECT *, FROM_UNIXTIME(field_time_value) AS newdatetimeformat FROM content_field_time;

Now, I guess I just need to figure out the best way to do the UPDATE/INSERT query so that the new datetime field contains all my dates.

This is my datestamp table:
TABLE `content_field_time`
`vid` int(10) unsigned NOT NULL default '0',
`delta` int(10) unsigned NOT NULL default '0',
`nid` int(10) unsigned NOT NULL default '0',
`field_time_value` int(11) default NULL,
`field_time_value2` int(11) default NULL,

This is my datetime table:
TABLE `content_field_datetime`
`vid` int(10) unsigned NOT NULL default '0',
`nid` int(10) unsigned NOT NULL default '0',
`delta` int(10) unsigned NOT NULL default '0',
`field_datetime_value` datetime default NULL,
`field_datetime_value2` datetime default NULL,

The datetime table already seems to have blank values for all the nid's and vid's but obviously not for the deltas. Should I use an update query joined on vid and nid? Or should I delete these empty records and insert from complete records?

pribeh’s picture

Any luck with this MikeyLikesit? I'm looking to do the same.

arlinsandbulte’s picture

Status: Active » Closed (won't fix)

Hi,
I am just indiscriminately closing all support requests with no activity for more than 1 year.
If you consider this to still be a valid issue / support request, feel free to re-open.
BUT,
if you are re-opening this issue, please provide specific details on how this issue can move forward.

Thanks.