Checking filedatetime

  • Thread starter Thread starter Silvester
  • Start date Start date
S

Silvester

I check the file creation date/time of a custom dll on app startup in my
autoexec macro using

if (FileDateTime(filepath) = "21/3/2004 4:26:16 PM"
etc

When distributing the app I find that each user machine returns the file
creation date/time in different formats eg:

3/21/2004 16:26:16
3/21/04 4:26:16 PM

which throws the "if" condition off and halts the autoexec.

How can I check the (FileDateTime(filepath) for the above conditions no
matter what the formatdatetime of the user machine ?

Thanks in advance
 
Silvester said:
I check the file creation date/time of a custom dll on app startup in
my autoexec macro using

if (FileDateTime(filepath) = "21/3/2004 4:26:16 PM"
etc

When distributing the app I find that each user machine returns the
file creation date/time in different formats eg:

3/21/2004 16:26:16
3/21/04 4:26:16 PM

which throws the "if" condition off and halts the autoexec.

How can I check the (FileDateTime(filepath) for the above conditions
no matter what the formatdatetime of the user machine ?

Thanks in advance

The FileDateTime function returns a date value, not a string, so compare
it to a date value, not a string:

If (FileDateTime(filepath) = #3/21/2004 4:26:16 PM# Then

I think you must specify the date literal using mm/dd/yyyy format if you
want to be sure it will be interpreted correctly.
 
Thanks Dirk,

absolute oversight on my part. After comparing it to a date value (yes,
mm/dd/yyyy is correct) - it works fine on development as well as user
systems.
 
Back
Top