📄 ch11_4.c
字号:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
time_t now;
struct tm *local,*gmt;/* 声明local结构变量 */
now = time(NULL);/* 取得系统目前时间 */
printf("%d 秒\n",now);
printf("现在时间:ctime():%s", ctime(&now));/*转为一般时间格式 */
local = localtime(&now);
printf("本地时间:asctime():%s", asctime(local));/*转为一般时间格式 */
gmt = gmtime(&now);/*取得格林威治时间 */
printf("格林威治时间:%s", asctime(gmt));
system("pause");
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -