PROBLEM WITH THE DATE FORMAT USED BY HOLLYWOOD AND THE AMIGA SYSTEMS
;Format dates:
;"jueves 10-nov-22 12:51:49" ;Format got from a file save with: Execute("Date >ENVARC:MiHora")
;"11-Nov-2022 12:51:49" ;Format from computer clock and Hollywood.
;We make the MiHora file:
Execute("Date >ENVARC:MiHora")
;Get computer date and hour:
FechaSystem$=GetDate(#DATELOCAL)
;Get the date from the file created with Execute on MorphOS or AmigaOS3.9
OpenFile(1, "ENVARC:MiHora", #MODE_READ)
While Not Eof(1) Do FechaFile$=ReadString(1)
CloseFile(1)
;Here is the problem with the different format, even when you with the
;instruction RightStr(FechaFile$, 19) you remove the day "jueves" from
;from the string but the problem is the month "nov" for example in lower
;letter because Hollywood uses "Nov".
ResultaCompara=CompareDates(FechaFile$, FechaSystem$)
;The CompareDates only compare full dates in the format dd-mmm-yyyy hh:mm:ss
;but with the month in capital letter.
The question is the different format between Hollywood and the date system in the month, it is curiously that Hollywood uses the Months and the system uses the months, the difference the first letter capital letter on Hollywood lower case on the system.
Because Hollywood is a cross platform environment, I think it is impossible to have compatibility to all date formats. If the built-in functions can't be used for some reason, I would request an enhancement there.
But why can't you use GetDate(#DATELOCAL)? With this function you get code that works on much more target machines. Even on Amiga the date format seems not to be consistent, at least in German OS 3.1 I get an upper case Nov.
And if you really need to use the date command then you could use LowerStr() for both strings before comparing.
The solution of Execute("Date >ENVARC:MiHora") has its explain I have problems with my PowerBook and MacMini with the clock battery and I found this solution to save the date and recover it, in my little tool BootClock, using the date from MorphOS system for after recover the date with the system instruction Date.