Solved

Date Formatting

Posted on 2002-06-05
3
148 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
[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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 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