How to calculate hours, minutes or seconds between two time values?

If you have time values, just subtract them, and you’ll get the interval length in seconds:

select end_time – start_time
from …

If you want to get minutes, divide the result by 60, and if you want hours by 3600.

If you have timestamps instead of times, the difference is in days, so you if you want seconds, you need to multiply the value by 60 * 60 * 24.

Link: http://www.firebirdfaq.org/faq36/

Deixar um comentário

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Modificar )

Imagem do Twitter

You are commenting using your Twitter account. Log Out / Modificar )

Facebook photo

You are commenting using your Facebook account. Log Out / Modificar )

Connecting to %s

Seguir

Get every new post delivered to your Inbox.