Working with hours

Posted on 2016-10-03
Last Modified: 2016-10-03
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 :(

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

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

Open in new window

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

Question by:hidrau
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 23

Accepted Solution

Ferruccio Accalai earned 500 total points
ID: 41826260
This code works fine for me
procedure TForm1.Button1Click(Sender: TObject);
  H: Ttime;
  mTime, mMinu: String;
  mTime := '09.30.00';
  mMinu := '00.01.25';
  H := StrToTime(mTime)+ StrToTime(mMinu);

Open in new window

What kind of problem are you having?
LVL 23

Expert Comment

by:Ferruccio Accalai
ID: 41826267
Anyway you could use inCsecond function from DateUtils

Something like
uses DateUtils;
  mTime := '09.30.00';
  H := StrToTime(mTime);

Open in new window


Author Comment

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

thanks Ferruccio

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month4 days, 10 hours left to enroll

635 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