dardime Posted January 7, 2016 Share Posted January 7, 2016 (edited) Hi there i need to add date and time to my sql but its only adding the date.... My code: $colname_rs = "-1"; if (isset($_GET['iID'])) { $colname_rs = (get_magic_quotes_gpc()) ? $_GET['iID'] : addslashes($_GET['iID']); } mysql_select_db($database_localhost, $localhost); $query_rs = "SELECT *,DATE_FORMAT(dtDate,'%d %b %Y, %h:%i %p') AS dtSDate FROM tbdo WHERE iID = '". $colname_rs."'"; $rs = mysql_query($query_rs, $localhost) or die(mysql_error()); $row_rs = mysql_fetch_assoc($rs); $totalRows_rs = mysql_num_rows($rs); Thanks in advance for your help! Edited January 7, 2016 by dardime Quote Link to comment https://forums.phpfreaks.com/topic/300210-adding-date-and-time-to-sql/ Share on other sites More sharing options...
requinix Posted January 7, 2016 Share Posted January 7, 2016 The time is in there too. Are you sure the dtDate field is a DATETIME and not just a DATE? Quote Link to comment https://forums.phpfreaks.com/topic/300210-adding-date-and-time-to-sql/#findComment-1529223 Share on other sites More sharing options...
dardime Posted January 7, 2016 Author Share Posted January 7, 2016 (edited) yeah dtDate is DATETIME format Edited January 7, 2016 by dardime Quote Link to comment https://forums.phpfreaks.com/topic/300210-adding-date-and-time-to-sql/#findComment-1529225 Share on other sites More sharing options...
requinix Posted January 7, 2016 Share Posted January 7, 2016 What's the rest of the code? The stuff between the query you posted and where you output the date. Quote Link to comment https://forums.phpfreaks.com/topic/300210-adding-date-and-time-to-sql/#findComment-1529228 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.