## Adding a duration to a start time string to get a finish time?

excel formula to calculate time worked
how to add time in excel
how to add hours to time in excel
how to calculate date and time difference in excel
excel calculate elapsed time between two dates
excel calculate hours between two times after midnight
how to add minutes and seconds in excel

I have a string called `startTime` and I want to add a `duration` (that's in minutes) to get a `finishTime`.

Here's some sample data:

```startTime : 10:15

duration: 90
```

In python, what's the best way to add that duration so that the `finishTime` would be `11:45`?

Thank so much, any help much appreciate.

Try this:

```import datetime

d = datetime.datetime.strptime("10:12","%H:%m") + datetime.timedelta(minutes=90)
new = d.strftime('%H:%m')
```

`new` will be `11:45`.

Fifth Annual Workshop on Space Operations Applications and , The two mandatory fields are the activity name and the duration of the activity. of the fields of the activity data structure: Name - string - this is used as the unique id. Temporal Constraints - timing constraints between the start or finish of one design of the activity data structure, it is trivial to add new fields to the activity. If you can tolerate the 3.3ms accuracy and rounding provided by the DATETIME data-type, the duration calculation is incredibly simple. Just subtract the start date and time from the end date and time.

I recommend using `pandas` for tasks like this, since it is much more intuitive to use than using the `datetime` module directly.

```import pandas as pd
startTime = '10:15'
duration = '90'
finishTime = (pd.to_datetime(startTime , format='%H:%M')
+ pd.to_timedelta(duration + 'min')).strftime(format='%H:%M')
```

As pointed out by Torxed and shmee, pandas is not a built-in module and it is fairly large with around 70MB, thus it may not be suitable for everyone. But since pandas is imho the best tool to process time series data and since the question looked like something which is commonly needed when processing time series, I thought a solution with pandas might be interesting/of use.

Calculating time in Google Sheets: subtract, sum and extract date , If you have your start time and end time, it's not a problem to find out the time spent: Time duration in hours and minutes in Google Sheets. To apply the custom time format, go to Format > Number > More Formats > Custom number You can use the TIME function to add or subtract up to 60 seconds:. Related Articles. Using the TIME data type in SQL Server 2008 (6 March 2008). Using the DATE data type in SQL Server 2008 (6 December 2007). DATEDIFF Function Demystified (20 March 2007)

You could use `pd.to_datetime` in order to convert the strings to datetime objects, and add the minutes using `pd.to_timedelta`. Finally convert the datetime to the desired format using `strftime`:

```import pandas as pd
(pd.to_datetime( '10:15', format='%H:%M') + pd.to_timedelta(90, unit='m')).strftime('%H:%M')
#'11:45'
```

Microsoft Excel 2010 Data Analysis and Business Modeling: Data , How can I use the TIMEVALUE function to convert a text string to a time? How do I extract the hour, minute, or second from a given time? before the start time, then 24*(finish time–start time) yields a negative number of hours, but adding 24​  Duration represents the amount of time a task is expected to take. Click on the Duration cell of a sub-task and type in the length of time. You can use a few different formats: Weeks (e.g. 2w) Whole working days (e.g. 4d) Partial working days (e.g. 3.5d) Hours (e.g. 7h). Minutes (e.g. 60m) Seconds (e.g. 500s) and milliseconds (e.g. 50000ms)

Calculate time in Excel: time difference, add, subtract and sum times, You will learn a few useful formulas to sum times and add hours, minutes or seconds to a given time. Another simple technique to calculate the duration between two To get the time difference in a single time unit (hours ,minutes or Supposing that your start time is in A2 and end time in B2, you can  We can first use the slow, looping method to add 1 to each value in our vector: g <- rnorm(100000) h <- rep(NA, 100000) # Start the clock! ptm <- proc.time() # Loop through the vector, adding one for (i in 1:100000){ h[i] <- g[i] + 1 } # Stop the clock proc.time() - ptm user system elapsed 0.34 0.06 0.41

Add or subtract time - Excel, Let's say that you need to add two different time values together to get a total. On the Home tab, in the Cells group, choose Format, and then choose Format Cells. In cell D2, subtract the end time from the start time by entering the formula  Hi Craig, thanks for your reply. i like the drop down idea, that will work well. the bit i am stuck on is how i can calculate total hours worked in a day from the start and finish times. eg start 8.15 and finish 4.30. how do i change time format into number format to get me total hours worked of 8 hours and 15 minutes???

AppleScript: The Comprehensive Guide to Scripting and Automation , Layout: Meeting DB Date 21.06.2006 Sta't'l'lme 933 AM I: ' End 'I'lme 1013] AM " A l You then tell this layout to delete any previous find requests; otherwise, these you write the starting time followed by three dots and then the finishing time. the text in those fields, you add two equals signs to the start ofyour strings. When times cross midnight. Calculating elapsed time is more tricky if the times cross a day boundary (midnight). For example, if the start time is 10:00 PM one day, and the end time is 5:00 AM the next day, the end time is actually less than the start time and the formula above will return a negative value, and Excel twill display a string of hash characters (#####).

• Not at all debating that :) However, I feel that a recommendation to use a 3rd party lib should come along with some disclaimer stating that fact and should ideally contain a link to the package homepage/documentation if available. On an aside: I think you should add `import pandas as pd` for completeness sake :D