Hey NogDog,
Yes, it's pretty much way too late to change the table structure. I'm working with SugarCRM 's contact management architecture. Thousands of Archived email, (inbound, sent, campaigns etc.) all of which receive a datetime entry (formated 'Y-m-d H:i:s') however its hit & miss for those records which receive the accompanying and separate date and time entries AND deciphering just how when and (most importantly) WHY those entries are -- or ARE NOT made-- promises to be a huge undertaking in and of itself - never mind CHANGING it all now.
So it follows that - No, the datetime field (date_entered) is not the result of concatenating start date and time.
Start date & time are null, and I'm trying to derive their values from date_entered (which is never null) and insert them.
While I REALLY LIKE SugarCRM, it has 2 major and widely documented and shortcomings:
1.Email Handling
2. Date Time Handling.
So here I am.
The bug I am trying to hack my way around lies in that Sugar's Email module (and numerous sub-panels) look to the columns: start_date, and start_time to then (sadly) CONCATENATE the two for out-put as Date Sent & Date Received in a list_view format, meaning that should an email record's date and time fields be NULL, the user cannot tell from the list view what date/time the email was sent or received (nor sort by it neither so... grrr)
If I get your general intent here, I'm thinking your suggesting something like:
$startDate = date('Y-m-d', strtotime($date_entered));
$startTime = date('H:i:s', strtotime($date_entered));
$query = "UPDATE emails SET time_start = '$StartTime', date_start = $StartDate"; //FOREGOING THE WHERE IS NULL
$result = mysql_query($query) or die(mysql_error());
-- though I don't have any idea if strtotime works in reverse (timetostr?) and STRINGS I've got -- via preg_splt -- but I still need a loop to retrieve and so define $date_entered for each record, and another to update each record with the data derived from the first. No?