unemployment Posted July 19, 2011 Share Posted July 19, 2011 DATE_FORMAT(`info`.`last`, '%W, %D \of %M %Y') AS '2', fails on me. I think it is because info.last is a unix timestamp. If that is the issue, then can someone please tell me how to convert it properly. $sql[$x] = "SELECT 'pm_conversations' AS `table`, `pm_conversations`.`conversation_id` AS `row_id`, `pm_conversations`.`conversation_subject` AS `0`, `info`.`total` AS '1', DATE_FORMAT(`info`.`last`, '%W, %D \of %M %Y') AS '2', '' AS '3', '' AS '4', '' AS '5', '' AS '6', '' AS '7', '' AS '8', '' AS '9', '' AS '10', '' AS '11', '' AS '12', '' AS '13' FROM `pm_conversations_users` INNER JOIN ( SELECT `conversation_id`, COUNT(`conversation_id`) AS `total`, MAX(`message_date`) AS `last` FROM `pm_messages` GROUP BY `conversation_id` ) AS `info` ON `pm_conversations_users`.`conversation_id` = `info`.`conversation_id` INNER JOIN `pm_conversations` ON `pm_conversations_users`.`conversation_id` = `pm_conversations`.`conversation_id` WHERE (`pm_conversations_users`.`user_id` = {$GLOBALS['user_info']['uid']} AND `conversation_subject` LIKE '%{$messages_subject}%' AND `pm_conversations_users`.`deleted` = 0)"; Quote Link to comment https://forums.phpfreaks.com/topic/242354-convert-unix-timestamp/ Share on other sites More sharing options...
requinix Posted July 19, 2011 Share Posted July 19, 2011 Unless you need it converted in the SQL, get the integer timestamp and convert it in PHP. The alternative is using FROM_UNIXTIME. Quote Link to comment https://forums.phpfreaks.com/topic/242354-convert-unix-timestamp/#findComment-1244772 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.