BUG: Date formats that contain 'gg' for Emperor Era year are not formatted correctly with the COleDateTime class when you set the locale to Japanese on a computer that is running Windows 2000 (826556)
The information in this article applies to:
- Microsoft Windows 2000 Professional
- Microsoft Windows 2000 Professional SP1
- Microsoft Windows 2000 Professional SP2
- Microsoft Windows 2000 Professional SP3
- Microsoft Windows 2000 Professional SP4
SYMPTOMSIn Regional options, you set the Date to Japanese, and you set the Long date format to gg yy 'Year' MM 'Month' dd 'Date' on a computer that is running Microsoft Windows 2000 where Year, Month, and Date are in Japanese. When the COleDateTime class is used to output the date, the year that is displayed remains "2004" instead of the Japanese Emperor year "16."
CAUSEThis problem is caused by a bug in the strftime and VarBstrFromDate functions that format the date. These low-level functions cause the COleDateTime class to fail.WORKAROUNDTo work around this problem in Windows 2000, use the Win32 API GetDateFormat funtion. The GetDateFormat function correctly formats the Japanese Emperor Era year. To do this, replace the code in the CMainFrame::CMainFrame() function with the following code: const MAX_STR = 30;
char strDate[MAX_STR];
SYSTEMTIME time01={2004,1,5,1,1,1,1,1};
GetDateFormat(LOCALE_SYSTEM_DEFAULT,0, &time01,"dddd,dd MMM yyyy", strDate,MAX_STR);
MessageBox(strDate,"Date",MB_OK);
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.
This bug was corrected in Microsoft Windows XP.
REFERENCESFor more information about how to develop Web-based solutions for Internet Explorer, visit the following Microsoft Developer Network (MSDN) Web sites:
Modification Type: | Major | Last Reviewed: | 7/13/2004 |
---|
Keywords: | kbcode kbMessageBox kbAPI kbbug KB826556 kbAudDeveloper |
---|
|