I'm trying to do some mathematics using a time value in PHP. It's dead simple in MySQL:
mysql> select date, duration, miles, sec_to_time(time_to_sec(duration) / miles) as speed from runs where shoes=6 order by date; +------------+----------+-------+----------+ | date | duration | miles | speed | +------------+----------+-------+----------+ | 2003-07-06 | 01:55:12 | 12.43 | 00:09:16 | | 2003-07-13 | 01:59:41 | 13 | 00:09:12 | | 2003-07-18 | 00:47:33 | 6 | 00:07:55 | | 2003-07-20 | 01:22:53 | 10 | 00:08:17 | | 2003-07-27 | 02:15:27 | 15 | 00:09:01 | | 2003-08-03 | 02:25:07 | 16 | 00:09:04 | | 2003-08-10 | 01:44:29 | 12 | 00:08:42 | | 2003-08-17 | 02:41:55 | 18.5 | 00:08:45 | | 2003-08-24 | 02:07:45 | 14 | 00:09:07 | +------------+----------+-------+----------+ 9 rows in set (0.01 sec) We get a nice list of runs with the calculated minutes/miles (speed) field included. This requires converting the stored time field to seconds, doing the division, then converting the resulting seconds back to a time format. Unfortunately I want my darn PHP web page to do this calculation and spit it out with my other run data but I can not find any useful PHP function similar to MySQL's sec_to_time() or time_to_sec(). Nor can I make mktime() do anything useful here. Does anyone know of any PHP function that will solve my above need? -- Trevor Smith | [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]