Chinaunix首页 | 论坛 | 博客
  • 博客访问: 119144
  • 博文数量: 39
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 375
  • 用 户 组: 普通用户
  • 注册时间: 2015-05-15 22:27
文章分类
文章存档

2018年(2)

2017年(37)

我的朋友

分类: C/C++

2017-09-07 11:16:55

输出结果:2017 09 05 16 31 11

点击(此处)折叠或打开



  1.     #include <stdio.h>

  2.     #include <string.h>

  3.     #include <stdlib.h>

  4.     #include <unistd.h>

  5.     #include <time.h>



  6.     int main(){

  7.      time_t now;

  8.      struct tm *timenow;

  9.      char time_end[1024];

  10.   

  11.      time(&now);

  12.      timenow = localtime(&now);

  13.      //asctime(timenow);

  14.      strftime(time_end,1024,"%Y %m %d %H %M %S",timenow);

  15.      printf("%s\n",time_end);

  16.      return 0;

  17.     }

阅读(1197) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~