Compatibility of GetDate
Posted: Thu Nov 17, 2022 11:31 am
With the code is more clean:
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.
Code: Select all
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.