On 10-01-11 08:42, Sven wrote:
> Dear SQLite users,
>
> I've created a Microsoft Access 2003 database with three complex queries 
> written in pure SQL language. The function of the database is to 
> document and calculate the daily work-time.
>
> Today I want to convert this database to SQLite but I have problems with 
> my written queries: How can I calculate the difference of two times and 
> show the result as double value?
>
> For more information I'll include one example: One table hold the two 
> times (start_time, end_time) and the calculated result (shown in the 
> table as 'difference'):
>
> [code]
> start_time | end_time | difference
> 08:00:00 | 16:30:00 | 8.5
> [/code]
>
> The result of the difference between the two times (start_time, 
> end_time) shown in the table above as 'difference' will be calculated 
> with the following SQL-query code within Microsoft Access 2003:
>
> [code]
> ( [end_time] - [start_time] ) * 24
> [/code]
>
> and returns the following data '8.5'. While using the following query 
> code within SQLite:
>
> [code]
> select time(end_time) - time(start_time)
> [/code]
>
> I only get the following data returned: '8' (but not '8.5' as calculated 
> with SQL).
>
> So currently I don't know what to do next to solve my problem and 
> perhaps all the other users of this SQLite-users mailing list could help 
> me out.
>
> best regards
select (strftime('%s', time('now', '4 minutes')) - strftime('%s',
time('now')));
returns: 240    (4*60)

This was found via Google at:
http://www.mail-archive.com/sqlite-users@sqlite.org/msg56060.html

More help on the strftime function:
http://sqlite.org/lang_datefunc.html
http://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html

-- 
Luuk

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to