Work Time Card solution

Posted on 2004-11-13
Medium Priority
Last Modified: 2010-04-17
I work at an institute where we are paid hourly based on minutes.  If I word 6 hours and 15 minutes then I will annotate 6.25 on my time card.  My co-workers come confused when their work hours has to be annotated when their time cannot be calculated on an quarter-hour basis.  I'm looking for someone to create an function to calculate work-hour minutes. In simplicity, calculate total hours worked and calculate minutes from 0-99.

Please contact me for clarity.
Question by:mcdonald_g
  • 2
  • 2
LVL 13

Expert Comment

ID: 12576846
Sure, if you have access to the crontab on the server, you could do it just by scheduling a tar command with the arguments of the directories you want to add.

For instance, if you want to tar up /home/httpd and /usr/local/db you'd add the following entry to cron:

0 0 * * * /usr/bin/tar -cvf /home/your-user/backup.tar /usr/local/db /home/httpd

The 0 0 means run at the 0th minute of the 0th hour (so 12 midnight) and the '*'s mean every day, month, and day of the week.

The command is '/usr/bin/tar'
The '-c' option means 'create an archive'
The '-v' option means 'verbose output'
The '-f' option means 'create in the following file' (In this case /home/your-user/backup.tar)
The rest of the entries are directories you want to back up.

Tar will back up the directories recursively and maintain both path and permissions information.
LVL 13

Expert Comment

ID: 12576847
Ack, sorry, that was meant for another question. My bad.

Accepted Solution

SCDMETA earned 1000 total points
ID: 12576934
Is this what your are looking for?

Function GetHours(Hours as Integer, Minutes as Integer) as Double
    GetHours = (Hours + (Minutes/60)
End Function


Expert Comment

ID: 12577198
I do not want to intrude, thought that a java solution was required.

int getMinutes(int minutes)
   return (int) ( ((float)minutes/60)*100 );

Want to point out that minutes need to be converted to float before dividing by 60 so that the decimal part is not trimmed due to integer division. Multiplying it by 100 and casting to integer to get a number between 0 and 99.

Expert Comment

ID: 12577221
Guys, ignore my previous comment. Thx.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Loops Section Overview

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question