WNGZWZSC0110_MMMPDate Converter7ExcelLotus Full Impact@ 0 e File Source@)OK@Cancel@@ @  You MUST open a Lotus 1-2-3 WKS or WK1 sheet before beginning!O  ????==   n@ O9 R?97 *? T@9X@97\@97`@97b@973 M@=" ?i *??*?  : #+? date formatted cell(s) 59containing either formulas or text strings were found in 5;this worksheet. These cells and their contents are listed 5in the worksheet 55. You must manually verify 5&the correct operations of these cells.5   "333333?0333333?0  333333?0"333333?0333333?0  7*?0@,?/,?7*?0@,?/,? &#"The conversion has been completed!OOTN#JYou MUST open a Ashton-Tate Full Impact WKS or WK1 sheet before beginning!O  ????=T=,   n@ O9 R?97 *? T@9X@97\@97`@97b@97l  ҕ/ N@=  @k@i @k?i . *??*?  : #+? date formatted cell(s) 59containing either formulas or text strings were found in 5;this worksheet. These cells and their contents are listed 5in the worksheet 55. You must manually verify 5&the correct operations of these cells.5   "333333?0333333?0  333333?0"333333?0333333?0  7*?0@,?/,?7*?0@,?/,? &#"The conversion has been completed!T@9X@97\@97`@97b@97;O9 %?}90@97_O9KADATE?$ADDDAYS?ADDHOURS? ADDMINUTES? ADDMONTHS?DAY?DAYNAME?hHOUR?LMINUTE?. ADDSECONDS? ADDYEARS?ATIME?MONTH? MONTHNAME?NOW?vSECOND?XYEAR?< DATEVALUE?DATE?9AO *?   ?  "5"5@ ?*?   +??+??.T?A@939*?*?+? 55d?>ad?9dd?97ddd?97dddd?97?"y?>;yy?9yyyy?97?m?>mmm?9mmmm?97?m?9mm?97hh?9s?976 ҕ9 ?h?>Xh?9hh?97. ҕ9 rs?>Us?9ss?97. ҕ9 l  ҕ/ N@=  @k@i @k?i .  ? DateConverter, Convert AllNoYes8!DateConv.scz:duit = 1  !DateConv.scz:duit = 0 -!'DateConv.scz:global = 1;quit dialog boxZ G Convert ' 5' formatted as '55', or globally convert all?5d8 $ $;#$?@-@ $$?*@$-@*@$@?$?*@$$)$)$> ףp=?@\(,@#@ oA$$> ףp=?33333#@$Q@#@$@#@$#@$> ףp=?#@$)$$$433333)@#@$)@#@$\(,@#@$#@$)@#@$$)$b$$ $ $@$ $$)$$$?*@$-@*@ $ $ $?*@$$)$ oA Times-Roman$gfffff@%@ $3WINGZB Times-Romanb$#@$?@$3Date Converter cell_format current_row current_col num_rows num_colsd1 starting_row starting_col show_help open_sheet begin_adjustments abort sheet_name current_cell formulacellsnum_formula_cellsduitglobaldecimaltypeDateConv_ExcDateConv_1234 DateConv_FIg CheckForDateFormulas CustomDates Convert Draw_Logo {=============================================================================== PROGRAM NAME DateConv.scz COPYRIGHT INFORMATION Lotus and 1-2-3 are registered trademarks of Lotus Development Corporation. Microsoft and Excel are registered trademarks of Microsoft Corporation. Ashton-Tate and Full Impact are registered trademarks of the Ashton-Tate Corporation. DESCRIPTION This script aids the user in converting date serial numbers from foreign file formats to Wingz' date serial numbering scheme. LIBRARY MODULES DateConv_Exc () - Function for converting Excel files. DateConv_123 () - Function for converting Lotus files. DateConv_FI () - Function for converting Full Impact files. CheckForDateFormulas () - This function checks the current cell for date related functions and if they exist, the name of the cell is placed in the worksheet FormulaCells. CustomDates () - This function checks the current cell for cells formatted with the standard date formats from Excel. These are m/d/yy,d-mmm-yy, d-mmm,mmm-yy,m/d/yy h:mm. When Wingz converts a SYLK file from Excel, it will create Excel's standard date formats as custom formats. This is not valid with files saved as WK1 or WKS. Convert () - This function prompts the user whether or not to convert the number based on the displayed custom format. The reason for this is that time formats and date formats have the letter "m" in common, and date and time format strings can be used in conjunction with one another. NOTES None. HISTORY 03/27/90 - KHB - Initial code. ===============================================================================} DEFINE cell_format, current_row, current_col, num_rows, num_cols, d1, starting_row, starting_col, show_help, open_sheet, begin_adjustments, abort, sheet_name, current_cell, formulacells, num_formula_cells, duit, global, decimal, type NEW MODAL DIALOG BOX AT (-1,-1) (4.5inch,2.5inch) NAME DIALOG BOX "Date Converter" ADD RADIO BUTTON "Excel","Lotus","Full Impact" AT (2.4inch,0.2inch) (4.3inch,1.8inch) SHOW CONTROL TITLE "File Source@" OUTLINE 2 BORDER ADD PUSH BUTTON "OK@","Cancel@" AT (0.5inch,2inch) (4inch,2.4inch) DIALOG CANCEL PUSH BUTTON SELECT CONTROL 2 DIALOG DEFAULT PUSH BUTTON SCRIPT "DateConv.scz:duit = 1;DateConv.scz:type = CTVALUE(1,0)" ADD CUSTOM BUTTON AT (0,0) (2.3inch,1.9inch) SCRIPT "ON REPAINT CALL DateConv.scz:DRAW_LOGO() END REPAINT" NO LINE BORDER USE DIALOG BOX IF duit CASE type WHEN 1 CALL DateConv_Exc () WHEN 2 CALL DateConv_123 () WHEN 3 CALL DateConv_FI () END CASE END IF {============================================================================== FUNCTION NAME DateConv_Exc DESCRIPTION This function will correct dates in WKS, WK1, and SYLK files generated by Microsoft Excel version 1.5, as well as version 2.2 files with the starting date option of 1904. NOTES This function is necessary because Excel does not follow the convention established by Lotus for date serial numbers. Instead, Excel begins it's date series with 0 on Jan 1, 1904. Excel fails to read and write Lotus 1-2-3 generated WK1 or WKS files correctly. It performs no translations on the date numbers as they are read in. This situation causes Excel to be 4 years and 1 day ahead of Lotus 1-2-3 AND Wingz. If the date from Excel is before March 1, 1904, then the date is 4 years and two days off. For example, if Lotus 1-2-3 and Wingz believe that it is March 6, 1989, Excel believes that it is March 7, 1993. HISTORY 03/07/89 - KHB - Initial code. 03/10/89 - JVR - Enhanced module formatting. 05/13/89 - HLG - Removed the user interface from DateConv.scz and broke it down into 3 separate scripts: DateConv.Exc - to correct dates in WKS, WK1, and SYLK files generated by Microsoft Excel. DateConv.123 - to correct dates in WKS & WK1 files generated by Lotus 1-2-3. DateConv.FI - to correct dates in WKS & WK1 files generated by Ashton-Tate Full Impact. 02/22/90 - KHB - Added code to recognize and convert custom formats. Added capability to retain decimal portion of the date. serial number and discarded variable d2 by combining the adddays and the addyears into one equation. 03/27/90 - KHB - Believe it or not, the three scripts were merged again into 1. 05/15/90 - DWC - Removed the text constants "FormulaCells" in the GO TO WINDOW commands, to prevent a file permission error - which results in the creation of the FormulaCells sheet with the command NEW WORKSHEET "FormulaCells". The aforementioned command will cause a Unix error when the user doesn't have write premission in the directory where the file to be converted resides. ===============================================================================} FUNCTION DateConv_Exc () num_formula_cells = 0 IF (ISERR(NAME())) MESSAGE "You MUST open a Microsoft Excel WKS or WK1 sheet before beginning!" ELSE { valid name } sheet_name = NAME() REPAINT OFF NO AUTO MOVE SELECT ACTIVE CELLS num_rows = ROWS(SELECTION(1)) num_cols = COLS(SELECTION(1)) starting_row = ROW() starting_col = COL() current_row = 1 current_col = 1 UNSELECT WHILE (current_col <= num_cols) WHILE (current_row <= num_rows) current_cell = MAKECELL(current_col, current_row) GO TO CELL current_cell cell_format = BITAND(FORMAT(), 240) { Check for formulas or text dates. If so, do not change.} IF (ISERR(FORMULATEXT(RANGE(current_cell))) = 0) OR (ISSTRING(INDIRECT(current_cell)) = 1) current_row = current_row + 1 CALL CheckForDateFormulas (cell_format, current_cell) CONTINUE WHILE END IF { a formula or text date } { Check if cell is formatted with one of Excel's standard date formats.} IF (cell_format = 224) current_row = current_row + 1 CALL CustomDates () CONTINUE WHILE END IF { a standard Excel date format } IF (cell_format = 80) OR (cell_format = 96) OR (cell_format = 112) OR (cell_format = 128) OR (cell_format = 144) decimal = INDIRECT(current_cell) - INT(INDIRECT(current_cell)) IF INDIRECT(current_cell) <= 60 d1 = ADDDAYS(ADDYEARS(INDIRECT(current_cell),4),2) ELSE d1 = ADDDAYS(ADDYEARS(INDIRECT(current_cell),4),1) END IF PUT d1 + decimal INTO current_cell END IF { a date format } current_row = current_row + 1 END WHILE { rows } current_row = 1 current_col = current_col + 1 END WHILE { columns } GO TO CELL MAKECELL(starting_col,starting_row) IF (num_formula_cells > 0) MESSAGE STRING(num_formula_cells - 1, 0) & " date formatted cell(s) " & "containing either formulas or text strings were found in " & "this worksheet. These cells and their contents are listed " & "in the worksheet "&formulacells&". You must manually verify " & "the correct operations of these cells." GO TO WINDOW sheet_name WINDOW LOCATION (0,0) WINDOW SIZE (.60 * DESKRIGHT(),.85 * DESKBOTTOM()) GO TO WINDOW formulacells WINDOW LOCATION (.60 * DESKRIGHT(), 0) WINDOW SIZE (.30 * DESKRIGHT(),.85 * DESKBOTTOM()) GO TO CELL A1 COLUMN WIDTH RANGE A1 TO ((.25 * DESKRIGHT() - (1440 * .25)) * .25) COLUMN WIDTH RANGE B1 TO ((.25 * DESKRIGHT() - (1440 * .25)) * .75) END IF { if formula or text cells found } AUTO MOVE REPAINT ON REPAINT ALL WINDOWS MESSAGE "The conversion has been completed!" END IF { worksheet loaded } END FUNCTION { End of function DateConv_Exc () } {============================================================================== FUNCTION NAME DateConv_123 DESCRIPTION This function will correct dates in WKS & WK1 files generated by Lotus 1-2-3. NOTES This function is necessary because Lotus 1-2-3 believes that 1900 is a leap year and thus counts February 29, 1900 as a legitimate date. This is not so. The rule for leap years is that they are every year evenly divisible by four except for centesimal years (1800, 1900, 2000) unless the centesimal year is evenly divisible by 400. That is why the year 2000 will be a leap year but 1900 was not. HISTORY 03/07/89 - KHB - Initial code. 03/10/89 - JVR - Enhanced module formatting. 05/13/89 - HLG - Removed the user interface from DateConv.scz and broke it down into 3 separate scripts: DateConv.Exc - to correct dates in WKS & WK1 files generated by Microsoft Excel. DateConv.123 - to correct dates in WKS & WK1 files generated by Lotus 1-2-3. DateConv.FI - to correct dates in WKS & WK1 files generated by Ashton-Tate Full Impact. 03/27/90 - KHB - Believe it or not, the three scripts were merged again into 1. 05/15/90 - DWC - File permission fix. (see main module) ===============================================================================} FUNCTION DateConv_123 () num_formula_cells = 0 IF (ISERR(NAME())) MESSAGE "You MUST open a Lotus 1-2-3 WKS or WK1 sheet before beginning!" ELSE { valid name } sheet_name = NAME() REPAINT OFF NO AUTO MOVE SELECT ACTIVE CELLS num_rows = ROWS(SELECTION(1)) num_cols = COLS(SELECTION(1)) starting_row = ROW() starting_col = COL() current_row = 1 current_col = 1 UNSELECT WHILE (current_col <= num_cols) WHILE (current_row <= num_rows) current_cell = MAKECELL(current_col, current_row) GO TO CELL current_cell cell_format = BITAND(FORMAT(), 240) { Check for formulas or text dates. If so, do not change } IF (ISERR(FORMULATEXT(RANGE(current_cell))) = 0) OR (ISSTRING(INDIRECT(current_cell)) = 1) current_row = current_row + 1 CALL CheckForDateFormulas (cell_format, current_cell) CONTINUE WHILE END IF IF (cell_format = 80) OR (cell_format = 96) OR (cell_format = 112) OR (cell_format = 128) OR (cell_format = 144) IF INDIRECT(current_cell) <= 59 d1 = ADDDAYS(INDIRECT(current_cell),1) PUT d1 INTO current_cell END IF END IF { a date format } current_row = current_row + 1 END WHILE { rows } current_row = 1 current_col = current_col + 1 END WHILE { columns } GO TO CELL MAKECELL(starting_col,starting_row) IF (num_formula_cells > 0) MESSAGE STRING(num_formula_cells - 1, 0) & " date formatted cell(s) " & "containing either formulas or text strings were found in " & "this worksheet. These cells and their contents are listed " & "in the worksheet "&formulacells&". You must manually verify " & "the correct operations of these cells." GO TO WINDOW sheet_name WINDOW LOCATION (0,0) WINDOW SIZE (.60 * DESKRIGHT(),.85 * DESKBOTTOM()) GO TO WINDOW formulacells WINDOW LOCATION (.60 * DESKRIGHT(), 0) WINDOW SIZE (.30 * DESKRIGHT(),.85 * DESKBOTTOM()) GO TO CELL A1 COLUMN WIDTH RANGE A1 TO ((.25 * DESKRIGHT() - (1440 * .25)) * .25) COLUMN WIDTH RANGE B1 TO ((.25 * DESKRIGHT() - (1440 * .25)) * .75) END IF { if formula or text cells found } AUTO MOVE REPAINT ON REPAINT ALL WINDOWS MESSAGE "The conversion has been completed!" END IF { worksheet loaded } END FUNCTION { End of function DateConv_123 () } {============================================================================== PROGRAM NAME DateConv.FI DESCRIPTION This function will correct dates in WKS & WK1 files generated by Ashton-Tate Full Impact. NOTES This function is necessary because Full Impact does not follow the convention established by Lotus for date serial numbers. Instead, Full Impact begins it's date series with 0 on Jan 1, 1904. Full Impact fails to read and write Lotus 1-2-3 generated WK1 or WKS files correctly. It performs no translations on the date numbers as they are read in. This situation causes Full Impact to be 4 years and 1 day ahead of Lotus 1-2-3 AND Wingz. If the date from Full Impact is before March 1, 1904, then the date is 4 years and two days off. For example, if Lotus 1-2-3 and Wingz believe that it is March 6, 1989, Full Impact believes that it is March 7, 1993. HISTORY 03/07/89 - KHB - Initial code. 03/10/89 - JVR - Enhanced module formatting. 05/13/89 - HLG - Removed the user interface from DateConv.scz and broke it down into 3 separate scripts: DateConv.Exc - to correct dates in WKS & WK1 files generated by Microsoft Excel. DateConv.123 - to correct dates in WKS & WK1 files generated by Lotus 1-2-3. DateConv.FI - to correct dates in WKS & WK1 files generated by Ashton-Tate Full Impact. 02/23/90 - KHB - Added capability to retain decimal portion of the date serial number and discarded variable d2 by combining the adddays and the addyears into one equation. 03/27/90 - KHB - Believe it or not, the three scripts were merged again into 1. 05/15/90 - DWC - File permission fix. (see main module) ===============================================================================} FUNCTION DateConv_FI () num_formula_cells = 0 IF (ISERR(NAME())) MESSAGE "You MUST open a Ashton-Tate Full Impact WKS or WK1 sheet before beginning!" ELSE { valid name } sheet_name = NAME() REPAINT OFF NO AUTO MOVE SELECT ACTIVE CELLS num_rows = ROWS(SELECTION(1)) num_cols = COLS(SELECTION(1)) starting_row = ROW() starting_col = COL() current_row = 1 current_col = 1 UNSELECT WHILE (current_col <= num_cols) WHILE (current_row <= num_rows) current_cell = MAKECELL(current_col, current_row) GO TO CELL current_cell cell_format = BITAND(FORMAT(), 240) { Check for formulas or text dates. If so, do not change } IF (ISERR(FORMULATEXT(RANGE(current_cell))) = 0) OR (ISSTRING(INDIRECT(current_cell)) = 1) current_row = current_row + 1 CALL CheckForDateFormulas (cell_format, current_cell) CONTINUE WHILE END IF IF (cell_format = 80) OR (cell_format = 96) OR (cell_format = 112) OR (cell_format = 128) OR (cell_format = 144) decimal = INDIRECT(current_cell) - INT(INDIRECT(current_cell)) IF INDIRECT(current_cell) <= 60 d1 = ADDDAYS(ADDYEARS(INDIRECT(current_cell),4),2) ELSE d1 = ADDDAYS(ADDYEARS(INDIRECT(current_cell),4),1) END IF PUT d1 + decimal INTO current_cell END IF { a date format } current_row = current_row + 1 END WHILE { rows } current_row = 1 current_col = current_col + 1 END WHILE { columns } GO TO CELL MAKECELL(starting_col,starting_row) IF (num_formula_cells > 0) MESSAGE STRING(num_formula_cells - 1, 0) & " date formatted cell(s) " & "containing either formulas or text strings were found in " & "this worksheet. These cells and their contents are listed " & "in the worksheet "&formulacells&". You must manually verify " & "the correct operations of these cells." GO TO WINDOW sheet_name WINDOW LOCATION (0,0) WINDOW SIZE (.60 * DESKRIGHT(),.85 * DESKBOTTOM()) GO TO WINDOW formulacells WINDOW LOCATION (.60 * DESKRIGHT(), 0) WINDOW SIZE (.30 * DESKRIGHT(),.85 * DESKBOTTOM()) GO TO CELL A1 COLUMN WIDTH RANGE A1 TO ((.25 * DESKRIGHT() - (1440 * .25)) * .25) COLUMN WIDTH RANGE B1 TO ((.25 * DESKRIGHT() - (1440 * .25)) * .75) END IF { if formula or text cells found } AUTO MOVE REPAINT ON REPAINT ALL WINDOWS MESSAGE "The conversion has been completed!" END IF { worksheet loaded } END FUNCTION { End of function DateConv_FI () } {=============================================================================== FUNCTION NAME CheckForDateFormulas DESCRIPTION This function checks the current cell for date related functions and if they exist, the name of the cell is placed in the worksheet FormulaCells. RETURNS Nothing. PARAMETERS current_format - the format of the cell as determined by the formula BITAND(FORMAT(), 240). the_cell - the cell being checked expressed as a string. NOTES None. HISTORY 03/10/89 - JVR - Initial code. 05/15/90 - DWC - File permission fix. (see main module) ===============================================================================} FUNCTION CheckForDateFormulas (current_format, the_cell) DEFINE cell_formula, formula_flag formula_flag = 0 cell_formula = "" IF (current_format = 80) OR (current_format = 96) OR (current_format = 112) OR (current_format = 128) OR (current_format = 144) IF (ISERR(FORMULATEXT(RANGE(the_cell))) = 0) cell_formula = UPPER(FORMULATEXT(RANGE(the_cell))) ELSE { else must be text } cell_formula = CELLTEXT(RANGE(the_cell)) END IF formula_flag = 1 ELSEIF (current_format = 0) OR (current_format = 16) IF (ISERR(FORMULATEXT(RANGE(the_cell))) = 0) cell_formula = UPPER(FORMULATEXT(RANGE(the_cell))) IF (CONTAINS(cell_formula, "ADATE")) formula_flag = 1 ELSEIF CONTAINS(cell_formula, "ADDDAYS") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "ADDHOURS") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "ADDMINUTES") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "ADDMONTHS") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "DAY") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "DAYNAME") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "HOUR") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "MINUTE") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "ADDSECONDS") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "ADDYEARS") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "ATIME") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "MONTH") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "MONTHNAME") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "NOW") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "SECOND") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "YEAR") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "DATEVALUE") formula_flag = 1 ELSEIF CONTAINS(cell_formula, "DATE") formula_flag = 1 END IF { formula contains a date keyword } END IF { cell contains a formula } END IF { date format } IF (formula_flag) IF (num_formula_cells = 0) NEW WORKSHEET "" LOCATION (DESKRIGHT(), DESKBOTTOM()) + (1440, 1440) formulacells=NAME() HIDE ENTRY BAR HIDE TOOL BOX HIDE HEADINGS num_formula_cells = num_formula_cells + 1 END IF { if first formula cell found create hidden sheet } GO TO WINDOW formulacells PUT current_cell INTO MAKECELL(1, num_formula_cells) PUT """" & cell_formula & """" INTO MAKECELL(2, num_formula_cells) GO TO CELL MAKECELL(1, num_formula_cells) ALIGN CENTER num_formula_cells = num_formula_cells + 1 GO TO WINDOW sheet_name REPAINT OFF END IF { formula found so add to FormulaCells worksheet } END FUNCTION { CheckForDateFormulas } {=============================================================================== FUNCTION NAME CustomDates DESCRIPTION This function checks the current cell for cells formatted with the standard date formats from Excel. These are m/d/yy,d-mmm-yy,d-mmm,mmm-yy,m/d/yy h:mm. When Wingz converts a SYLK file from Excel, it will create Excel's standard date formats as custom formats. This is not valid with files saved as WK1 or WKS. RETURNS Nothing. PARAMETERS None NOTES None. HISTORY 02/22/90 - KHB - Initial code. ===============================================================================} FUNCTION CustomDates () DEFINE fmt, isdate, pos, len, i, start_pos, end_pos, new_fmt fmt = LOWER(CUSTOMFORMAT()) len = LENGTH(fmt) start_pos = 0 end_pos = 0 { If format string has a literal, strip out the literal and leave the formatting chars. } FOR i = 0 TO len-1 IF CODE(MID(fmt,i,1)) = 34 IF start_pos = 0 start_pos = i + 1 ELSE end_pos = i + 1 END IF END IF END FOR new_fmt = LEFT(fmt,start_pos-1) & " " & MID(fmt,end_pos,len) isdate = 0 IF MATCH(new_fmt,"d",1) <> 0 { If new_fmt contains a d, dd, ddd, dddd, it's a date format. } IF (CONTAINS(new_fmt,"d") = 1) OR (CONTAINS(new_fmt,"dd") = 1) OR (CONTAINS(new_fmt,"ddd") = 1) OR (CONTAINS(new_fmt,"dddd") = 1) isdate = 1 END IF ELSEIF MATCH(new_fmt,"y",1) <> 0 { If new_fmt contains a yy or yyyy, it's a date format. } IF (CONTAINS(new_fmt,"yy") = 1) OR (CONTAINS(new_fmt,"yyyy") = 1) isdate = 1 END IF ELSEIF MATCH(new_fmt,"m",1) <> 0 { If format string contains "mmm" or "mmmm", then date format involved. } IF ((CONTAINS(new_fmt,"mmm") = 1) OR (CONTAINS(new_fmt,"mmmm") = 1)) isdate = 1 ELSEIF ((CONTAINS(new_fmt,"m") = 1) OR (CONTAINS(new_fmt,"mm") = 1)) { Format string might contain time as well as date formatting, so prompt user if they want to convert, else do the conversion. } IF (CONTAINS(new_fmt,"h") = 1) OR (CONTAINS(new_fmt,"s") = 1) { If serial number < 1, do not convert } IF INT(INDIRECT(current_cell)) = 0 isdate = 0 ELSE isdate = Convert (fmt) END IF REPAINT OFF ELSE isdate = 1 END IF END IF ELSEIF MATCH(new_fmt,"h",1) <> 0 { If new_fmt contains a h or hh, it's a time format. } IF (CONTAINS(new_fmt,"h") = 1) OR (CONTAINS(new_fmt,"hh") = 1) { If serial number < 1, do not convert } IF INT(INDIRECT(current_cell)) = 0 isdate = 0 ELSE isdate = Convert (fmt) END IF END IF ELSEIF MATCH(new_fmt,"s",1) <> 0 { If new_fmt contains an s or ss, it's a time format. } IF (CONTAINS(new_fmt,"s") = 1) OR (CONTAINS(new_fmt,"ss") = 1) { If serial number < 1, do not convert } IF INT(INDIRECT(current_cell)) = 0 isdate = 0 ELSE isdate = Convert (fmt) END IF END IF END IF IF isdate { If the format is a date string. } decimal = INDIRECT(current_cell) - INT(INDIRECT(current_cell)) IF INDIRECT(current_cell) <= 60 d1 = ADDDAYS(ADDYEARS(INDIRECT(current_cell),4),2) ELSE d1 = ADDDAYS(ADDYEARS(INDIRECT(current_cell),4),1) END IF PUT d1 + decimal INTO current_cell END IF END FUNCTION { END OF FUNCTION CustomDates () } {=============================================================================== FUNCTION NAME Convert DESCRIPTION This function prompts the user whether or not to convert the number based on the displayed custom format. The reason for this is that time formats and date formats have the letter "m" in common, and date and time format strings can be used in conjunction with one another. RETURNS 1 - Convert the number 0 - Do not convert the number PARAMETERS None NOTES None. HISTORY 02/22/90 - KHB - Initial code. ===============================================================================} FUNCTION Convert (fmt) IF global RETURN 1 END IF NEW MODAL DIALOG BOX AT (-1,-1) (6400,2000) NAME DIALOG BOX "DateConverter" ADD PUSH BUTTON "Convert All","No","Yes" AT (200,1450) (6200,1800) DIALOG DEFAULT PUSH BUTTON SCRIPT "DateConv.scz:duit = 1" SELECT CONTROL 2 DIALOG CANCEL PUSH BUTTON SCRIPT "DateConv.scz:duit = 0" SELECT CONTROL 1 SCRIPT "DateConv.scz:global = 1;quit dialog box" ADD TEXT "Convert '" & INDIRECT(current_cell) & "' formatted as '" & fmt & "', or globally convert all?" at (200,100) (6200,1300) NO LINE BORDER USE DIALOG BOX RETURN duit END FUNCTION { END OF FUNCTION Convert () } FUNCTION Draw_Logo () VIEWPORT (0,0) (1,1) SQUARE WINDOW (0,0) (15,15) FILL BG RGB (4,59,0) FILL RECTANGLE (1.5,6.5) (14.5,9) OPEN POLYGON MOVE (.5,13.3) DRAW (14.5,13.3) DRAW (7.5,.2) DRAW (.5,13.3) CLOSE POLYGON FILL POLYGON KILL POLYGON FILL RECTANGLE (.57,6.7) (14.43,9.8) FILL FG WHITE() OPEN POLYGON MOVE (.57,9.85) DRAW (2.24,9.8) DRAW (2.45,9.5) DRAW (1,9.55) DRAW (.57,9.8) FILL POLYGON KILL POLYGON OPEN POLYGON MOVE (12.6,9.5) DRAW (12.75,9.8) DRAW (14.43,9.8) DRAW (14,9.55) DRAW (12.55,9.5) CLOSE POLYGON FILL POLYGON KILL POLYGON FILL BG RGB (6,98,0) OPEN POLYGON MOVE (1,13) DRAW (14,13) DRAW (7.5,1) DRAW (1,13) CLOSE POLYGON FILL POLYGON KILL POLYGON OPEN POLYGON MOVE (.5,13.3) DRAW (14.5,13.3) DRAW (14,13) DRAW (1,13) DRAW (.5,13.3) CLOSE POLYGON FILL POLYGON KILL POLYGON TEXT COLOR WHITE() TEXT FONT "Times-Roman" TEXT SIZE 24 MOVE (3.8,10.5) DRAW TEXT "WINGZ" TEXT SIZE 14 TEXT STYLE "B" TEXT FONT "Times-Roman" FILL BG RGB(6,98,0) FILL RECTANGLE (1,7) (14,9.5) MOVE (1.3,7.7) DRAW TEXT "Date Converter" END FUNCTION