| 
              
                
                  | 
                      
                        
                          |  | THE HYPERCARD CENTER |  
 |  
                    |  |  Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page. convertconvert {value |container}[from  ¬    formatName  [and formatName]] ¬    to formatName [and formatName]
 The convertcommand changes a value expressed as a valid date, time, or date and time format to another format. You use and formatName in combination with the firstformatNameto convert a value to any two formats (often the date and time). The form convert value to formatNamereturns the convertedvaluein the local variableit. The formconvert [ph:container to formatNameconverts a value in a chunk orcontainer(including variables) and places the result in that chunk or container. You use the form from formatin situations where you don't want HyperCard to do the conversion automatically. There are four types of date formats: seconds, a positive integer equal to the number of seconds since 12:00    midnight on January 1, 1904dateItems, a comma-delimited list of seven positive integers equal to the    following values:year,month,day,hour,minute,second,dayNumberwheredayNumber 1 = Sundayand7 = Saturday.date, which has one of three formats:** [dayName,] monthName, day, year **  month/day/year **  month-day-year
 where dayName=Sunday,Sun,Monday,Mon,Tuesday,Tue,Wednesday,Wed,Thursday,Thur,Friday,Fri,Saturday, orSat monthName=January,Jan,February,Feb,March,Mar,April,Apr,May,June,Jun,July,Jul,August,Aug,September,Sep,October,Oct,November,Nov,December, orDec
 time,  which has the following format:hour:minute[:second] [timeOfDay]wheretimeOfDay=amorpm
 You can precede the format names dateandtimewith an optional adjective,  producing the following formats: abbrev date  Fri, Jun 15, 1990 long date    Friday, June 15, 1990 short date   6/15/90 abbrev time  3:30 PM long time        3:30:00 PM short time       3:30 PM
 Note: HyperCard can handle dates from 1/1/1000 to 12/31/9999 in all formats. It handles dates from 1/1/1 to 12/31/9999 only in the dateItemsorsecondsformat. If you try to convert an invalid date (such as"Friday, May 50, 1990"), HyperCard sets the HyperTalk functionthe resultto"Invalid date." When System 7.1 is running, HyperCard uses the date and time settings from the Date & Time Control Panel. Examplesconvert "1/1/1960" to seconds -- the result goes into the variable it convert "1/1/1960" to seconds and long date convert (the seconds - startSeconds) to abbreviated time convert bkgnd field "date" to seconds -- the result goes into the field convert last word of field "Info" to short date convert totalTime to abbreviated time -- the result goes into totalTime convert field 1 from date to dateItems convert myVar from seconds to long date convert card field "Date and Time" from date and time to dateItems
 Demo Scripton daysOld   repeat until birthTime is a date     put "What is your birthdate?" after sayIt     ask sayIt with the short date     if (it is empty) OR (the result is "Cancel") then exit daysOld     put it into birthTime     if birthTime is not a number     then put birthTime && "is not a valid date." & return into sayIt   end repeat   convert birthTime to seconds -- change birthTime to seconds   convert the date to seconds  -- get the current date   put (it - birthTime) / 86400 into daysOld   -- 86400 seconds in 1 day   convert birthTime to long date   answer "You were born on" && birthTime & ", and you are currently" &&¬   daysOld && "days old." end daysOld
 Related TopicsPlaceholderscontainerHyperTalk Definition A place where you can store and retrieve a value. There are six types of containers in HyperCard: a variable, a button, a field, the selection, the Message box, and menus. myVariable [the] selection the Message box btn 3 bg btn "Names" card field 1 bkgnd field "Total" menu 2 menu "Edit"
 Additionally, you can refer to a button or field by its part  number: card part 1 last background part
 AppleScript Definition An object that contains one or more other objects, known as elements of the container. In a reference, the container specifies where to find an object. You specify containers with the reserved words oforin. You can also use the possesive form ('s) to specify containers. For example, in first window's name
 the container is first window. The object it contains is a name property. formatNameOne of the following names of a date or time format: seconds dateItems [adjective] date [adjective] time
 For example: abbr date abbr time abbrev date abbrev time abbreviated date abbreviated time dateItems long date long time seconds short date short time
 adjectiveOne of the following: abbr abbrev abbreviated long short
 See also: formatName 
                HyperTalk Reference
               
 |