Subject Re: [firebird-support] Timestamp difference
Author Ivan Prenosil
> I need to get the difference in seconds from system time and login
> time in my app. So, when a user log into system I insert 'Now' value
> into a timestamp field. But the problem is to get the difference with
> actual system time.
>
> If I do "select CURRENT_TIMESTAMP-USER_LOGIN FROM TIME_TABLE" I get
> the result in days (I think so). But no way to convert it to seconds.
> I tried to divide result by 3600 but is always 0!

The day (at least in Europe) has 24 hours, one hour has 60 minutes,
and one minute has 60 seconds. And try multiplying instead of dividing :)

(timestamp1 - timestamp2) * 24*60*60
or
(timestamp1 - timestamp2) * 86400

Ivan