I need to get the amount of seconds between two dates, and only during working hours (ex 0800-1600).
Any suggestions on how to do this in Java?
long seconds = ((datenow.getTime() - datethen.getTime()) / 1000);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could use something like this:
which first calculates the number of days between your days and subtracts the number of non-work-time-seconds from the real difference.
For the weekends, 8 additional non-work-hours per day are added.