Get locale long date from CTime MFC class (C++)



Here is the code to get locale long date from CTime MFC class (C++).

 
CString FormatLocaleLongDate(CTime tm)
{
 
	CString strValue;
	SYSTEMTIME st;
	tm.GetAsSystemTime(st);
	GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &st, NULL, strValue.GetBufferSetLength(SMALL_TEXT_LENGTH), SMALL_TEXT_LENGTH);
	strValue.ReleaseBuffer();
	return strValue;
 
}


Leave a Reply

Your email address will not be published. Required fields are marked *