Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date

Status
Not open for further replies.
Nov 27, 2004
4
YU
How do I obtain current (computer's) date in my Clipper program?
And how do I compare it with one stored in a database?

Say, there is some date stored as an entry in a database and I have to compare it with current date and count the day difference. ie how many days have passed. How do I do it in Clipper? Is there a way to get the machine's date or it is necessary to prompt the user to enter the actual date?

I am a newbie so please be as specific as you can. Thank you.
 
Code:
...
dCurrentDate := Date()
nDateDiff := 4  // four days to go
...
select database
goto top
while !Eof()
   if database->date_field < dCurrentDate
      // do some processing
   endif
   if (dCurrentDate - database->date_field) > nDateDiff
      // processing for date difference : Older then 4 days
   endif
   if Abs(dCurrentDate - database->date_field) > nDateDiff
      // processing for date difference : Older or newer then 4 days
   endif
   skip
end

HTH
TonHu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top