I want to split a single row into multiple rows based on time.
SrNo Employee StartDate EndDate
---------------------------------------------------------------------------
1 emp1 30/03/2020 09:00:00 31/03/2020 07:15:00
2 emp2 01/04/2020 09:00:00 02/04/2020 08:00:00
Expected output is below:
SrNo Employee StartDate EndDate
---------------------------------------------------------------------------
1 emp1 30/03/2020 09:00:00 30/03/2020 11:59:00
1 emp1 31/03/2020 00:00:00 31/03/2020 07:15:00
2 emp2 01/04/2020 09:00:00 01/04/2020 11:59:00
2 emp2 02/04/2020 00:00:00 02/04/2020 08:00:00
Day start from 00:00 AM to next day 00:00 AM. When EndDate time is greater than 00:00 AM (midnight) then split this date in two rows. First row end date is 30/03/2020 11:59:00 and next row start 31/03/2020 00:00:00.
Please help me to get is solved.