我知道我可以做到这一点,如果我有一个struct tm结构,但是如果我想用SYSTEMTIME做同样的事情。 我可以手动这样做,但只是想知道是否有这样做的function已经。
谢谢
void PrintTimeSCII(struct tm *time) { char timebuf[26] = {0}; asctime_s(timebuf, 26, time); printf("%s\n", timebuf); }
GetDateFormat可以用于这个。 它可以使用给定语言环境的适当格式格式化日期。 下面的代码展示了如何以简短格式将其用于用户的默认语言环境。
char timebuf[26]; GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &sysTime, NULL, timebuf, ARRAYSIZE(timebuf));