Date addition

Started by
7 comments, last by sanguineraven 22 years ago
I am writing a basic database in Pascal as part of an assignment. It should record equipment details, like whether its on loan, who to, when etc. Each equipment is lent out for a 6 week period. I have added the date function, so when a piece of equipment is taken out it records the date i declared the variable current_date :string; and then current_date:=datetimetostr(now); current_date:=datetimetostr(date); that gets the date ready to print to screen, but when the details of equipment are viewed i want to show the return date, so i need to add 6 weeks on to the date, i have tried doing it a few ways but have been unable to solve it. i realise that not many people will have done pascal, but any help would be appreciated What about me? What about Raven?
Advertisement
umm, elo? anyone who knos pascal?

What about me? What about Raven?
I think you need to give more code*not to much though, just around 2 from the top and bottom*
Hello there,

dates are basically a real type with a certain
precision. They can be added to by simply doing an
addition ie


  //add ten days to now and display in captionCaption := FormatDateTime(''dd/mm/yy hh:mm:ss'',Now+10);  


Hope it helps

Mark
yeah thats good, i tried a few things like that but couldn''t get it working. You don''t happen to know if there is a way to implement DOS commands (or similar) such as copy, rename, so i could create a basic backup system?

What about me? What about Raven?
In pascal....not me. But in c/c++, go to www.cpp-home.com
Hello there,

if your using delphi then you can just use
the windows commands

CopyFile
CopyFileEx
DeleteFile

etc..

Hope it helps

Mark

sweet, yeah those help as im using delphi.

Is there a way to set up a similar loop as used in games? Currently, my main body is

quote:
load_file_patients;
load_file_equipment;

repeat
begin
view_main_menu;
choice_main_menu;
end
until main_menu_choice = 50;
readln;


in this way, it sits in menu until a choice is made, and i would then have the menu procedure where they use arrow keys to move up and down.

However, what i wanted was so it waits for input (readkey) and if there is non after, say a second it starts the loop again, this way i could have a clock which updates itself as the whole screen is shown each second. so really what I''m after is instead of having

key_press := readkey;

where you must press a key, i want it so it will continue on after a certain time has expired.

is this possible?

What about me? What about Raven?
:''( i seemed to have f**** it up. I have a repeat loop which should quit when escape is pushed.

quote:
repeat
key_press := readkey;
case ord(key_press) of
77 : right;
end;


until ord(key_press) = 27;


in theory, if i psu hte hright arrow key it kill perform ''right'' and when i push ESC it should break from the loop? However, I am finding that i have to psuh ESC then enter??? this didn''t happen before, i create a simple quick program to test it and it worked but then i tried porting to this and it doesn''t? I''ve tried various ways round it but im tired and frustrated

What about me? What about Raven?

This topic is closed to new replies.

Advertisement