Solved

Working with hours

Posted on 2016-10-03
3
72 Views
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 :(

var
  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?

thanks
Alexandre
0
Comment
Question by:hidrau
[X]
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
3 Comments
 
LVL 22

Accepted Solution

by:
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;

Open in new window

What kind of problem are you having?
0
 
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);
  Showmessage(Timetostr(IncSecond(h,85)));

Open in new window

0
 
LVL 1

Author Comment

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

thanks Ferruccio
0

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 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