I am trying to calculate the work of hours my employee's has done. the system works like this : When there's a login the timestamp write itself in a database and the same when I logout. now I try to calculate the work of hours and I get an error saying "Strftime is not a recognize built in function.
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\PROJECT\TEAM5\TEAM5\TEAM5 PROJECT\DATABASE\STOREMANGE.MDF;Integrated Security=True;Connect Timeout=30");
string sql = "SELECT Username ,logdate as 'Date' , MIN(logtime) as 'IN' , MAX(logtime) as 'OUT', " +
" CAST(((strftime('%s', max(logtime)) - strftime('%s', min(logtime))) % (60 * 60 * 24)) / (60 * 60) AS TEXT) || ':' || " +
" CAST((((strftime('%s', max(logtime)) - strftime('%s', min(logtime))) % (60 * 60 * 24)) % (60 * 60)) / 60 AS TEXT) as 'HOURS - HH:MM' " +
" FROM Work_card group by Username , logdate order by logdate";
All I'm looking for it to calculate the hours and it seems like with the strftime it't not working. appreciate any kind of help, thank you !