Solved

Increment Current Time with x seconds

Posted on 2002-05-23
3
155 Views
Last Modified: 2010-04-04
How can I increment the current DateTime with a x amount of seconds? So for example I want to have a TDateTime of Now + 30 secs returning a TDateTime. Remember that if the current time is lets say 20 secs away from the hour it should increment the hour as well. The same with the day if it's a couple of seconds away from the end of the day. Thanx in advance.
0
Comment
Question by:skynergy
[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 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 7029186
function addseconds(aDateTime : TDateTime; Seconds : Integer) : TDateTime;
begin
  result := aDateTime + (seconds / 60 / 60 / 24);
end;

not tested

meikl ;-)
0
 

Author Comment

by:skynergy
ID: 7029256
No, sorry that doesn't work. It doesn't increment now with that number of seconds.
0
 

Author Comment

by:skynergy
ID: 7029290
Oops, it does! Sorry I made a mistake in some other part of my code. Thank you for This simple answer ;-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Title # Comments Views Activity
Delphi and Access based Enumeration 9 91
Graphics32 under Delphi 10.1 Berlin 2 186
how to make 2 step back? ..\..\ ExtractFilePath (paramstr(0)) 5 84
MS Access from Delphi 31 103
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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

751 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