HyperCard 2.0: Changes to the Convert Function

HyperCard 2.0v2 handles the Convert function differently than HyperCard 1.2.x.

In early versions of HyperCard, the convert function would ignore parts of
a date that were inconsistent. For example: April 24, 1991 is a
Wednesday. Try the following line of HyperTalk code:

 convert "Saturday, April 24, 1991" to seconds

The result is 2755296000, the number of seconds from January 1, 1904 to
April 24, 1991. HyperCard 1.2.x ignored the (incorrect) Saturday portion.

If you try the same line of code in HyperCard 2.0, the result is "Invalid
Date."   HyperCard 2.0 does not allow the day name to be inconsistent with
the date.

If you have a script that tries to take advantage of this feature of
HyperCard 1.2.x, you will have to re-work it before it will function
properly in version 2.0 or later. If you know the dayname of the long date
will be incorrect, here's a suggested substitution:

instead of:
 convert theDate to seconds

use:
 put item 2 to 3 of theDate into theDate -- Drops the Day Name
 convert theDate to seconds

If you are trying to use the Calendar stack from the old HyperCard, open

the background script and insert the line of code marked with "--
Inserted for HC 2.0 Compatibility."

function startOfMonth aDate     -- the seconds of Monday before the 1st
 put 60*60*24 into OneDay      --seconds in a day
 put aDate into it
 convert it to long date
 put 1 into word 2 of item 2 of it     --first of month
 put item 2 to 3 of it into it -- Inserted for HC 2.0 Compatibility
 convert it to seconds
 convert it to long date
 repeat while item 1 of it <> "Sunday"
   convert it to seconds
   subtract OneDay from it    --look for previous Sunday
   convert it to long date
 end repeat
 convert it to seconds
 return it
end startOfMonth

This article is adapted from the Claris Tech Info database.
Support Information Services
Published Date: Feb 19, 2012