Jump to content

[SOLVED] PHP Date help


webwriter

Recommended Posts

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 MySQL

Q.  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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.