Solved

Date Formatting

Posted on 2002-06-05
3
145 Views
Last Modified: 2010-04-04
Hi,

I wondered if anyone can tell me how to calculate the date 15 days from a date that has been calculated.

My code below works out the date 30 days from current.Monthly is a string value.

Monthly := (FormatDateTime('dd/mm/yyyy', Now + 30));

I want to work out what the date is 15 days prior to the above date and store it in a variable.
Can anyone help?

Many Thanks
0
Comment
Question by:HotRod40
  • 2
3 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7055851
stringvar := (FormatDateTime('dd/mm/yyyy', yourdate - 15));

0
 

Author Comment

by:HotRod40
ID: 7055855
When I do this I get an error: 'Incompatible Types: String and Integer.
Any more ideas.
The code Im writing is this:

Prior:='FormatDateTime('dd/mm/yyyy', Monthly - 15));

Prior is a string.

Thanks
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 7055859
yep,
your monthly-var you must reconvert to tdatetime before

look at strtodate

meikl ;-)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 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

9 Experts available now in Live!

Get 1:1 Help Now