Date, Time, Currency Formats Different from International

Last reviewed: July 29, 1997
Article ID: Q114628
The information in this article applies to:
  • Microsoft Visual Basic Programming System, Applications Edition, version 1.0

SYMPTOMS

When you run a macro that formats a number with a date, time, currency, or standard number format in a Visual Basic, Applications Edition module, the format in the macro is different from the format displayed in the International dialog box of Control Panel.

This behavior occurs when your Country setting in the International dialog box is set to one of the following: Austria, Canada (French), Hungary, Slovak Republic, Croatia, Romania, Serbia, or Slovenia.

The following is a list of Country settings and the different date formats displayed in the International dialog box of Control Panel and in a Visual Basic module:

 Country              International                     Visual Basic
                      displays                          displays
 --------------------------------------------------------------------

 Austria              Short Date:  1994-5-6             1994-5-Friday

 Canada (French)      Short Date:  94/5/6               94-5-6

 Hungary              Long Date:   1994. May 6          1994 May 6.
                      Short Date:  1994.5.6             1994.5.6.

When the following country settings are used

   Croatia
   Romania
   Serbia
   Slovenia

a macro in a Visual Basic module displays date, time, currency, and numbers as United States formats.

CAUSE

Austria

This incorrect date format is caused by a problem in Microsoft Windows. When you set the Country setting to Austria in the International dialog box, the [intl] section of the WIN.INI file has the following incorrect setting:

   sShortDate=yyyy-MM-dddd

This causes the date in Visual Basic modules to be formatted with the full day name.

Canada(French)

This incorrect date format is caused by a problem in Microsoft Windows. The [intl] section in the WIN.INI file has the following inconsistent settings:

   sDate=/
   sShortDate=yy-mm-dd

The date separators in these settings should be consistent. (The default should be the hyphen (-) character.)

Hungary

This incorrect date format is also caused by a problem in Microsoft Windows. In the [intl] section in the WIN.INI file, both the sShortDate and the sLongDate settings correctly show a period at the end. The Visual Basic module uses these correct settings to format a date. In this case, the format of the dates in the International dialog box are incorrect.

Croatia, Romania, Serbia, and Slovenia

Visual Basic, Applications Edition does not recognize the Croatia, Romania, Serbia, and Slovenia system locales. For languages that are not recognized, date, time, currency, and number formats in Visual Basic modules use the default United States/English International settings.

More information about this is available in the XLREADME.HLP file. To view this file, do the following:

  1. In Microsoft Excel, press F1 to run Help.

  2. From the File menu, choose Open. From the File Name list, select XLREADME.HLP and choose OK.

  3. Select the Microsoft Excel Product Update topic.

  4. Scroll down to the Unrecognized System Locales topic.

WORKAROUND

Austria

To work around this problem and display the correct short date format in a Visual Basic module, do the following:

  1. Run Windows Control Panel and choose the International icon.

  2. Under Date Format, choose Change, then choose OK.

  3. In the International dialog box, choose OK.

Canada(French)

To correct this inconsistency, do the following:

  1. Run Windows Control Panel and choose the International icon.

  2. Under Date Format, choose Change.

  3. Under Short Date Format in the Separator box, type "/" (backslash) or "-" (hyphen) (without the quotation marks) to set the date separator you want to use. Choose OK.

  4. In the International dialog box, choose OK.
Keywords          : kbprg kbusage
Version           : 1.00
Platform          : WINDOWS


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.