PHP - Moved: Date_format
This topic has been moved to MySQL Help.
http://www.phpfreaks.com/forums/index.php?topic=308776.0 Similar TutorialsUPDATE table with topics SET forum = MySQL Help WHERE link = http://www.phpfreaks.com/forums/index.php?topic=347169.0 Hi all, I'm abit stuck, i've got two variables which a $timestamp = $myrow["t_stamp"]; - Grabbed from DB - stored like 2012-04-03 14:02 (for example) $format='F j, Y, g:i a' I'm trying to get it to display like Tuesday, 3rd April 14:02 or something like that but i just cant $timestamp->format($format) is what i've tired working with etc but nothing seems to work as it is only displayed as F j, Y, g:i a as text :S Can anyone help me please. Many thanks! J Can someone tell me what is the fault with my code? SELECT date_format(datecolumn,'%d %M %Y') as date FROM news WHERE article_id=$id $query = "SELECT * FROM my_db ORDER BY timestamp DESC"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line["subject"].",,".$line["$id"].",,".$line["article"].",,".$line["link"].",,,"; } echo $returnS; mysql_close($link); ?> iwant this format dd-mm-yyyy i have a DATETIME var set to DATETIME type in the DB Code: [Select] <?php echo date_format($row['DATETIME'],'%m-%d-%Y') ?> ERROR: Warning: date_format() expects parameter 1 to be DateTime, string given on line 510 At which point do I use DATE_FORMAT()? On insert, on select, or ideally can I use it when I echo it out? I haven't used this function before, so I'm not too familliar with it. Can I do something like this?.. echo DATE_FORMAT($item['created_at'], '%d/%m/%Y'); This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=319595.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=342919.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=327250.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=315910.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=309960.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=319767.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=342987.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=343318.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=328753.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=356314.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=313579.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=328917.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=328845.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=349322.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=356760.0 |