Skip to content

Tag: time

Get number of days between two dates in SQL

Fleet_ID State ODO_Reading Date_Added 1 F1 State 1 42000 10/01/2021 2 F1 State 1 43100 14/03/2021 3 F1 State 1 43900 26/04/2021 4 F2 State 1 63010 22/02/2021 5 F2 State 1 70800 06/04/2021 6 F3 State 2 17000 03/01/2021 7 F3 State 2 18560 19/03/2021 8 F3 State 2 19695 23/04/2021 Above is a sample database Is it…

SQLite Incomplete Time String

I have a table with incomplete time strings, such as ‘0:09.735’ (minutes:seconds.milliseconds). As the function strftime expects certain formats, such as ‘%H:%M:%f’, I have “to complete” the incomplete timestring first. The first strftime function with the complete timestri…

How to calculate employees working hours in sql

My company business hour is 7:30 to 18 and 13:00 to 15:00 is lunch time. Important part is about lunch time that should not calculate as working time of employee at all. So imagine employee start working at 8:30 and exit at 15:00 so the time of 4:30 hours should be calculate for him. actually I want to remove…

Check datatype of column after applying function MySQL

I want to know datatype of column after using a function. After using timediff function what datatype is it? I’ve looked at the doc to search for output datatype of a function https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html but could not find, Also it would be inefficient to memoriz…

setting time range in SQL Developer

I am working on a dataset that contains car accidents and their time of occurrence. (the data set exists in SQL Server under the name accident). I have a column that is in date format. I would like to extract the time from the column. Then add a new column called lightining_period label the time as daytime or…