I'm smarter than I thought... I figured it out. It seems the problem with MS Access is that it stores simple times with a date (probably a requirement of SQL). The date it stores times with is 1899-12-30. Unfortunately, from what I gather, Unix timestamps only go back to 1901... hence PHP has a difficult time handling the SQL return of 1899-12-30 13:00:00... so, how about simply changing the DATE pate of the date return?
$schedule = &$connection->Execute("select ClassDate, ClassTime from tblSchedule where class='$class_name' AND [ClassDate] >= #$today# ORDER BY [ClassDate] ASC"); $class_time = date ("g:i A", strtotime (ereg_replace('([0-9]*)-([0-9]*)-([0-9]*)','2000-12-31', $schedule->fields[1]))); if you want to break this down... //get field from the SQL query $class_time = $schedule->fields[1]; //replace date portion with something PHP won't have such a hard time with $class_time = ereg_replace('([0-9]*)-([0-9]*)-([0-9]*)','2000-12-31', $class_time ); //run a date function on it to format the time $class_time = date ("g:i A", strtotime ($class_time)); --------------------- John Asendorf - [EMAIL PROTECTED] Web Applications Developer http://www.lcounty.com - NEW FEATURES ADDED DAILY! Licking County, Ohio, USA 740-349-3631 Nullum magnum ingenium sine mixtura dementiae fuit > -----Original Message----- > From: Asendorf, John [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, March 05, 2002 1:39 PM > To: Php-Windows (E-mail) > Subject: [PHP-WIN] Displaying a MS Access - Medium time field > > > I have a MS Access 2000 database, which has a field whose > format is "Medium > Time" named $class_time. > > The $class_date (Format "Short Date") prints with no problem. > > If I try to take the field from the database (without > formatting) and echo > it, I get "1899-12-30 13:00:00" > > If I try: date ("format", strtotime($class_time)) with the > $class_time field > I get an unexpected error (probably because the date (as you > can see above) > is prior to Dec 13, 1901). > > If I try: date ("format", $class_time) I get 7:31 PM for every entry. > > Any solutions? This isn't my database, so I'd prefer not to > screw with it > too much if I can help it. CODE FOLLOWS: > > $class_date = $schedule->fields[0]; > $class_date = date ("l, F j, Y", strtotime ($class_date)); > $class_time = $schedule->fields[1]; > $class_time = date ("g:i A", $class_time ); //<--I have tried > this with > strtotime also to no avail > > echo "<td>$class_date<br />$class_time</td>\n"; //echoes date > wonderfully, > time all messed up > > > > > --------------------- > John Asendorf - [EMAIL PROTECTED] > Web Applications Developer > http://www.lcounty.com - NEW FEATURES ADDED DAILY! > Licking County, Ohio, USA > 740-349-3631 > Nullum magnum ingenium sine mixtura dementiae fuit > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php