Work Time Card solution

Posted on 2004-11-13
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
    LVL 13

    Expert Comment

    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

    Ack, sorry, that was meant for another question. My bad.
    LVL 6

    Accepted Solution

    Is this what your are looking for?

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

    LVL 2

    Expert Comment

    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.
    LVL 2

    Expert Comment

    Guys, ignore my previous comment. Thx.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    INTRODUCTION We all know how to code. But at times you simply want to insert a common code block into your existing code and amend it as per your requirements. This tool not only saves you time but also saves you the pain of typing it all out aga…
    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now