webwriter Posted January 1, 2007 Share Posted January 1, 2007 Hi all... new here and new to coding. I'm so happy to find this forum.Here's my issue:[quote]Dates and Times in MySQLQ. How do I pull out a date from a MySQL DATETIME, DATE, TIME, or TIMESTAMP field into a readable format?A. Thanks for the idea there James (Websitenoobie). His way:$DATE = date('M jS Y g:ia A', strtotime($MYSQLFORMAT));And another way:$sql = mysql_query("SELECT DATE_FORMAT(`date_field`, '%c-%e-%y') AS the_date FROM aTable");$row = mysql_fetch_assoc($sql);echo $row['the_date'];[/quote]This [i]should[/i] solve my problem, but I don't understand it.Here's my code:[code]<input name="startdate" value="<?=date("F j, Y")($Row[startdate])?>">[/code]I'm trying to pull out the timestamp and format it for editing, but something's wrong with my formatting (obviously!) Hopefully, this is a fast and easy one for someone to help sort for me... thanks in advance! Link to comment https://forums.phpfreaks.com/topic/32433-solved-php-date-help/ Share on other sites More sharing options...
chronister Posted January 1, 2007 Share Posted January 1, 2007 [code]<input name="startdate" value="<?=date("F j, Y")($Row[startdate])?>">[/code]Should be [code]<input name="startdate" value="<?=date("F j, Y",$Row['startdate']) ?>">[/code] Link to comment https://forums.phpfreaks.com/topic/32433-solved-php-date-help/#findComment-150700 Share on other sites More sharing options...
webwriter Posted January 1, 2007 Author Share Posted January 1, 2007 Excellent- will correct that now. Thank you so much! Link to comment https://forums.phpfreaks.com/topic/32433-solved-php-date-help/#findComment-150701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.