Archived

This topic is now archived and is closed to further replies.

Date addition

This topic is 5742 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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 caption

Caption := FormatDateTime(''dd/mm/yy hh:mm:ss'',Now+10);



Hope it helps

Mark

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
:''( 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?

Share this post


Link to post
Share on other sites