finding the average of timestamps

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
lobo78
Forum Newbie
Posts: 2
Joined: Thu Nov 20, 2003 11:18 am

finding the average of timestamps

Post by lobo78 »

How could I find the average of multiple timestamps? How about the average of time types? which would be easier?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: finding the average of timestamps

Post by Weirdan »

lobo78 wrote:How could I find the average of multiple timestamps?

Convert them to unix timestamp ([mysql_man]unix_timestamp[/mysql_man]), then compute the average, then convert the average back to the timestamp([mysql_man]from_unixtime[/mysql_man])
lobo78 wrote: How about the average of time types? which would be easier?
Doesn't make any difference whether you use timestamp or time types.
lobo78
Forum Newbie
Posts: 2
Joined: Thu Nov 20, 2003 11:18 am

Post by lobo78 »

that's a good idea, thanks!
Post Reply