?
Solved

Working with hours

Posted on 2016-10-03
3
Medium Priority
?
117 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 23

Accepted Solution

by:
Ferruccio Accalai earned 2000 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 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);
  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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

719 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