Guys and Dolls,
Windows does not always give the correct format for a short date.
DOS did, as far as I remember. My question is: can Windows read the information in the Dos file COUNTRY.SYS?
In other words, can the following code be ported to the Win32 platform?
------------------
mailto:[email protected][email protected]</A>
www.basicguru.com/zijlema/
Windows does not always give the correct format for a short date.
DOS did, as far as I remember. My question is: can Windows read the information in the Dos file COUNTRY.SYS?
In other words, can the following code be ported to the Win32 platform?
Code:
' Source code: PowerBASIC for DOS ' ' Author: [email protected] ' Copyright status: Public Domain ' FUNCTIONs to get country code and ' country specific delimiters for date, time and numbers $COMPILE EXE ' ----------------------------------------------------------------------- ' CountryInfo - returns a string with the following information: ' First byte (= string's ASCII) is either 0, 1 or 2 ' 0: date format = mdy (American) ' 1: date format = dmy (European) ' 2: date format = ymd (Asian or Japanese) ' Char 8: country specific decimal point ' Char 10: thousand separator ' Char 12: date separator ' Char 14: time separator FUNCTION CountryInfo AS STRING buffer$ = SPACE$(64) ' prepare buffer REG 8, STRSEG(buffer$) ' DS = segment REG 4, STRPTR(buffer$) ' DX = offset REG 1, &H3800 ' AX = service CALL INTERRUPT &H21 FUNCTION = buffer$ ' buffer filled END FUNCTION ' main CLS buff$ = CountryInfo code% = REG(2) formt% = ASC(buff$) dd$ = MID$(buff$, 12, 1) pbDate$ = DATE$ REPLACE "-" WITH dd$ IN pbDate$ PRINT "Your country code is: "; TRIM$(STR$(code%)) PRINT "The date delimiter in your country is: "; CHR$(34, 32); dd$; CHR$(32, 34) SELECT CASE formt% CASE 0 PRINT "Date format is: MM DD YYYY" CASE 1 PRINT "Date format is: DD MM YYYY" pbDate$ = MID$(pbDate$, 4, 3) + LEFT$(pbDate$, 3) + MID$(pbDate$, 7) CASE 2 PRINT "Date format is: YYYY MM DD" pbDate$ = MID$(pbDate$, 7) + dd$ + LEFT$(pbDate$, 3) + MID$(pbDate$, 4, 2) END SELECT PRINT "So a short date in Windows should look like this: "; pbDate$ END
------------------
mailto:[email protected][email protected]</A>
www.basicguru.com/zijlema/
Comment