Solved

# Working with hours

Posted on 2016-10-03
31 Views
Hello guys

I am having a problem that must be simple, but I am not being able to solve it.

I have a time in hh:mm:ss:

mTime = '09:30:00'
mMinu = '00:01:25'

I want to increase the Mminu in Mtime so that it can be:  '09:31:25'

When I do this, my time is increase and not crease the time :(

``````var
H : Ttime;
mTime, mMinu : String;
mTime := '09:30:00'
mMinu := '00:01:25'

H := StrToTime(mTime);
H := H + StrToTime(mMinu);
``````

Why it is increase my time? What should I do to solve this?

thanks
Alexandre
0
Question by:hidrau
• 2

LVL 22

Accepted Solution

Ferruccio Accalai earned 500 total points
ID: 41826260
This code works fine for me
``````procedure TForm1.Button1Click(Sender: TObject);
var
H: Ttime;
mTime, mMinu: String;
begin
mTime := '09.30.00';
mMinu := '00.01.25';
H := StrToTime(mTime)+ StrToTime(mMinu);
showmessage(timetostr(h));
end;
``````
What kind of problem are you having?
0

LVL 22

Expert Comment

ID: 41826267
Anyway you could use inCsecond function from DateUtils

Something like
``````uses DateUtils;
mTime := '09.30.00';
H := StrToTime(mTime);
Showmessage(Timetostr(IncSecond(h,85)));
``````
0

LVL 1

Author Comment

ID: 41826270
I solved with your example, it was something very simple but I couldn't see it :)

thanks Ferruccio
0

## Featured Post

### Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…