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

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
  • 2
LVL 22

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 22

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

840 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