Pieter van Heerden
2008-12-09 05:47:40 UTC
Dates are important in one of my applications. The date format is set in the dBase ini-file and in the application ini-file as 'date=DMY' and to make doubly sure I have also included a line in the set-up program that specifies the date format as DMY.
The problem comes from the following line where dates from two sources are combined to form a new date:
qicrf["plantdate"].value := ctod(str(day(qimp2rf["plantdate"].value),2,0,"0") + "/" + str(month(qimp2rf["plantdate"].value),2,0,"0") + "/" + str(year(qicrf["startdate"].value),4))
When running the application as a program under dBase, the above line always gives the expected date result. After rebuilding the project file, and running the resultant .exe file, this code once again behaves as expected. However, after building an install program and installing it on the same or a different computer this line starts to misbehave. Some dates produced are correct, but more than half show dates far beyond the expected upper limit. I have seen a similar result before when the date month or date day is taken as the year, in other words the date is read the wrong way round. Why would dates be read the wrong way round (if that is the problem((?)) if a date format has been set? Why does the problem only occur in an installed application and not in the origional under dBase? Why are some dates in the column apparently treated correctly and others not?
Please advise.
The problem comes from the following line where dates from two sources are combined to form a new date:
qicrf["plantdate"].value := ctod(str(day(qimp2rf["plantdate"].value),2,0,"0") + "/" + str(month(qimp2rf["plantdate"].value),2,0,"0") + "/" + str(year(qicrf["startdate"].value),4))
When running the application as a program under dBase, the above line always gives the expected date result. After rebuilding the project file, and running the resultant .exe file, this code once again behaves as expected. However, after building an install program and installing it on the same or a different computer this line starts to misbehave. Some dates produced are correct, but more than half show dates far beyond the expected upper limit. I have seen a similar result before when the date month or date day is taken as the year, in other words the date is read the wrong way round. Why would dates be read the wrong way round (if that is the problem((?)) if a date format has been set? Why does the problem only occur in an installed application and not in the origional under dBase? Why are some dates in the column apparently treated correctly and others not?
Please advise.