0

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.

James Z
  • 12,209
  • 10
  • 24
  • 44
user8625135
  • 23
  • 1
  • 1
  • 5
  • 2
    Welcome to StackOverflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – Sotos Jun 18 '18 at 07:07
  • What have you tried? Please post your code so we're helping you improve or fix it, rather than writing it from scratch – camille Jun 18 '18 at 17:13

0 Answers0