?
Solved

Date Formatting

Posted on 2002-06-05
3
Medium Priority
?
150 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 200 total points
ID: 7055859
yep,
your monthly-var you must reconvert to tdatetime before

look at strtodate

meikl ;-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

771 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