c# - SQLIte SUM datetimes -


i have database rows, time values. want sum of time values (generaly, format %h:%m).

i used sum value that:

select sum(n_hores) table; 

but 0.0.

how can ?

thanks

time values in hh:mm format strings, , strings cannot summed meaningfully.

you should convert these time values number (strftime(%s) returns number of seconds since 1970-01-01, have subtract offset start of day number of seconds corresponding time value):

select sum(strftime('%s', mytime) - strftime('%s', '00:00')) mytable 

you can convert number of seconds time string (time() returns in hh:mm:ss format):

select time(sum(strftime('%s', mytime) - strftime('%s', '00:00'))) mytable 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -