GetDateFormatEx 格式化字符串和自定义文本
GetDateFormatEx format string and custom text
取此代码:
GetDateFormatEx(_T("es"),
NULL,
&sysTime,
_T("d de MMMM"),
strDate.GetBuffer(_MAX_PATH), _MAX_PATH, nullptr);
我希望它显示为(例如):
5 de Enero
但实际上我最终得到了:
5 5e Enero
我们如何将自己的自定义文本添加到格式字符串中并使其不被解析?
将自定义文本放在单引号内,如下所示:
"d 'de' MMMM"
更多格式详细信息here。引用:
The application uses single quotation marks to mark characters to
display exactly as specified. If the application must display a single
quotation mark, it should place two single quotation marks in a row.
For example, 'abc''bar'
, is displayed as "abc'bar"
.
取此代码:
GetDateFormatEx(_T("es"),
NULL,
&sysTime,
_T("d de MMMM"),
strDate.GetBuffer(_MAX_PATH), _MAX_PATH, nullptr);
我希望它显示为(例如):
5 de Enero
但实际上我最终得到了:
5 5e Enero
我们如何将自己的自定义文本添加到格式字符串中并使其不被解析?
将自定义文本放在单引号内,如下所示:
"d 'de' MMMM"
更多格式详细信息here。引用:
The application uses single quotation marks to mark characters to display exactly as specified. If the application must display a single quotation mark, it should place two single quotation marks in a row. For example,
'abc''bar'
, is displayed as"abc'bar"
.