-   Linux - General (
-   -   Start Date + Time Duration = End Date/Time calculator? (

ToBe 09-23-2005 03:32 PM

Start Date + Time Duration = End Date/Time calculator?
I am in need of a calculator where I could put in the date and time, and then enter the duration, and it'd output the ending date/time.

This is for several Linux backup servers I have in place. I use crontab to start my backup scripts to backup various servers.

I know the approximate sizes beforehand, and use a bandwidth calculator to estimate the times the backup will take.

My head is starting to hurt from manually calculating the end-time of my script execution, so a tool like this would help heaps!

Anyone seen anything that does this?

I've tried googling for it... seems Time is such a BROAD subject, I'm having trouble finding the proverbial needle :)


cs-cam 09-24-2005 08:05 AM

I doubt there would be something like that, but it shouldn't be too difficult to accomplish with a bash script or something. Enter the size and bandwidth, do the math to work out how many seconds it'll take and then generate a timestamp for the start time, plus the amount of seconds and generate a date string from the new timestamp. bash and bc can do the math, date can do the timestamp work :)

Dark_Helmet 09-24-2005 02:43 PM

Actually, you're (probably) in luck ToBe. You already have a tool installed to do this: date

Pull up the man page if you don't believe me, or run a command like so:

$ date -d "2005-12-15 +5 hours +30 minutes"
Thu Dec 15 05:30:00 CST 2005
$ date -d "today +3 days +6 hours +15 minutes"
Tue Sep 27 20:56:00 CDT 2005
$ date -d "tomorrow +6123 seconds"
Sun Sep 25 16:23:55 CDT 2005

You can then modify the output to fit whatever format you need. Like I said, just pull up the man page and take a look at what's available.

ToBe 09-26-2005 10:17 AM


That date trick is exactly what I need. THANKS!!!

Great Tip

All times are GMT -5. The time now is 09:37 PM.