Get locale time from CTime MFC class (C++)



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

 
CString	FormatLocaleTime(CTime tm)
{
 
	CString strValue;
	SYSTEMTIME st;
	tm.GetAsSystemTime(st);
	GetTimeFormat(LOCALE_USER_DEFAULT, LOCALE_NOUSEROVERRIDE|TIME_NOSECONDS, &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 *