是否有像 asctime_s() 这样的函数适用于 Windows 中的 SYSTEMTIME 结构?
我知道如果我有一个 struct tm 结构我可以做到这一点,但是如果我想用 SYSTEMTIME 做同样的事情怎么办?我可以手动执行此操作,但只是想知道是否已经有函数可以执行此操作。
谢谢
void PrintTimeSCII(struct tm *time)
{
char timebuf[26] = {0};
asctime_s(timebuf, 26, time);
printf("%s\n", timebuf);
}
I know I can do this if I have a struct tm structure, but what if I want to do the same thing with a SYSTEMTIME. I could do this manually but just wondering if there's function that does this already.
Thanks
void PrintTimeSCII(struct tm *time)
{
char timebuf[26] = {0};
asctime_s(timebuf, 26, time);
printf("%s\n", timebuf);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GetDateFormat 可用于此目的。它可以使用适合给定区域设置的适当格式来格式化日期。下面的代码以短格式显示了如何将其用于用户的默认区域设置。
GetDateFormat can be used for this. It can format the date using the appropriate format for a given locale. Below code shows how to use it for the user's default locale, in short format.