I have a data set
Agent name Time stamp login/logout
Xyz 5/31/18 9:03:16 AM Login
Xyz 6/1/18 12:02:12 AM Logout
Abc 5/31/18 9:00:00 AM Login
Abc 5/31/18 11:59:00 PM Logout
I have written a code in R to count the login hours of an agent, but during the month ends the shifts are extended till 12 AM midnight as seen in the above example, but as the time changes to 12am the date aslo changes to next day due to which the code is not able to pic the login hours for the day i.e 5/31/18.
I want to convert the 6/1/18 12:02:12 AM
to 5/31/18 11:59:59 PM
i.e previous day as login time above 12AM is irrelevant. This should be dynamic i.e for any month end during the year.
The first case is the problem case during month end i.e agent Xyz
And 2nd case is the ideal case during month end i.e agent Abc.
I want to do this in the starting of the code without disturbing the current working of the code.