Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Increment Current Time with x seconds

Posted on 2002-05-23
3
Medium Priority
?
157 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 200 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

721 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