主页
C 语言
C 日期和时间
demo_date_strftime
运行 ❯
×
更改方向
保存代码
更改主题
#include
#include
int main() { time_t now = time(NULL); struct tm *t = localtime(&now); char buffer[100]; strftime(buffer, sizeof(buffer), "%d-%m-%Y %H:%M:%S", t); printf("Formatted time: %s\n", buffer); return 0; }