Is there an asctime_s () function that works for SYSTEMTIME structures in windows?

I know that I can do this if I have a struct tm structure, but what if I want to do the same with SYSTEMTIME. I could do it manually, but just wondering if there is a function that does this already.

thank

 void PrintTimeSCII(struct tm *time)
 {
     char timebuf[26] = {0};

     asctime_s(timebuf, 26, time);
    printf("%s\n", timebuf);
 }
+3
source share
1 answer

GetDateFormat can be used for this. It can format the date using the appropriate format for a given language. The code below shows how to use it for the user's default locale in short format.

char timebuf[26];
GetDateFormat(LOCALE_USER_DEFAULT, 
              DATE_SHORTDATE,
              &sysTime,
              NULL,
              timebuf, 
              ARRAYSIZE(timebuf));
+1
source

Source: https://habr.com/ru/post/1751830/


All Articles