Re: [PHP] format date field
On Wed, May 23, 2007 11:45 am, Mike Ryan wrote: I am reading in a date field from a mysql database the field on the screen shows up as 2007-05-01 on the screen I would like the field to show 05-01-2007 currently I am issueing the following command print $row['open']; how can I format this field??? while I am at it how can I accept the date field as 05-01-2007; http://dev.mysql.com/ Search date_format will answer the first one. The seocnd is probably a configurable setting at mysql startup, but I'd be leery of altering that... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] format date field
I am reading in a date field from a mysql database the field on the screen shows up as 2007-05-01 on the screen I would like the field to show 05-01-2007 currently I am issueing the following command print $row['open']; how can I format this field??? while I am at it how can I accept the date field as 05-01-2007; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] format date field
On 5/23/07, Mike Ryan [EMAIL PROTECTED] wrote: I am reading in a date field from a mysql database the field on the screen shows up as 2007-05-01 on the screen I would like the field to show 05-01-2007 currently I am issueing the following command print $row['open']; how can I format this field??? while I am at it how can I accept the date field as 05-01-2007; Look at MySQL's DATE_FORMAT() function. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] format date field
Leave the date as is, its a MySQL thing. To format it on your page, use the date function: $formattedDate = date(m-d-Y,strtotime($row[open])); http://us2.php.net/manual/en/function.date.php -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada Community College www.wncc.edu 775-445-3326 On May 23, 2007, at 9:45 AM, Mike Ryan wrote: I am reading in a date field from a mysql database the field on the screen shows up as 2007-05-01 on the screen I would like the field to show 05-01-2007 currently I am issueing the following command print $row['open']; how can I format this field??? while I am at it how can I accept the date field as 05-01-2007; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php