1

I want to format a COleDateTime as a CString, so i use

COleDateTime dt = GetMyDateTimeObj();
dt.Format(LOCALE_NOUSEROVERRIDE, GetCurrentLocaleID());

Since my program is multilanguage, GetCurrentLocaleID gives me the LCID currently selected (not in windows but in my program). So the above gives me the correctly formated string according to the selected user-language but its always in a format "date-with-year + time-with-seconds". I think this is the short format of a date and the long format of the time accordong to windows regional settings.

What can i do to get the String with - the year as just 2 numbers? - completely without the year? - the time-part without seconds?

Are there any switches to COleDateTime::Format that can give me year-as-2-digits, time-without-seconds but keeps fieldorder and separators specified by the LCID?

Of course i dont want to change any windows-regional-settings to do this and i dont want to use any fixed format-strings like _T("%d.%m.%Y %H:%M:%S") as this would break language-specific order of fields and separators.

Thanks for your hints and answers

Micha

suriel
  • 191
  • 1
  • 10
  • I tend to provide a series of predefined format strings in a combo along with custom and associated text box. Then the user has full control. – Andrew Truckle Jul 01 '16 at 13:43
  • this means, the user HAS to deal with the format whether he wants to or not. further more not all users want to care about formats, single letter abbreviations, some case sensitive and some not and so on... if you change the language of the application, date/timeformat doesnt follow or you have to give formatstrings for every language as well. thos seems to be very tedious – suriel Aug 03 '16 at 08:11

0 Answers0