Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Comparing date strings...


2 replies to this topic

dalinor

dalinor
  • Members
  • 2 posts

Posted 24 June 2002 - 15:52

I wish to compare two unformatted date strings during the beginning of the setup script.  

One of the date strings is stored in the string table.  The other date string is retrieved via the GetSystemInfo() function.  

The date string in the string table is similar in format to the string returned by the GetSystemInfo() function but each of the date components (month,day,year) is padded with zeros.  

The date string returned by GetSystemInfo() is of course NOT padded, consequently the comparison cannot take place by simply comparing equal fixed length substrings.

Essentially all I want to do is figure out which date is earlier.  I was wondering if anyone has come up with the simplest way of performing this calculation.  

Thanks.

nick_91

nick_91
  • Members
  • 9 posts

Posted 25 June 2002 - 09:15

Hello,
I have maybe not understood in details your problem, but:
GetSystemInfo retrieves a date MM - DD -YYYY.
You can use StrGetTokens where you specify a delimiter ("-").
Each element of the date is stored in a list line.
Then you can easily compare month, day and year with the other date.

Nicolas

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 25 June 2002 - 14:26

And to handle the padding of zeros, you can cast both of the string representations to numbers and compare those directly.
user posted image