Solved

Increment Current Time with x seconds

Posted on 2002-05-23
3
147 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
  • 2
3 Comments
 
LVL 27

Accepted Solution

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

not tested

meikl ;-)
0
 

Author Comment

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

Author Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now