Increment Current Time with x seconds

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.
skynergyAsked:
Who is Participating?
 
kretzschmarConnect With a Mentor Commented:
function addseconds(aDateTime : TDateTime; Seconds : Integer) : TDateTime;
begin
  result := aDateTime + (seconds / 60 / 60 / 24);
end;

not tested

meikl ;-)
0
 
skynergyAuthor Commented:
No, sorry that doesn't work. It doesn't increment now with that number of seconds.
0
 
skynergyAuthor Commented:
Oops, it does! Sorry I made a mistake in some other part of my code. Thank you for This simple answer ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.