#include <stdio.h>
#include <time.h>
using namespace std;
int main(void)
{
time_t t;
struct tm *x;
time( &t );
x = localtime(&t);
printf("year=[%d]\n", x->tm_year+1900);
printf("month=[%d]\n", x->tm_mon+1);
printf("day=[%d]\n", x->tm_mday);
printf("hour=[%d]\n", x->tm_hour);
printf("min=[%d]\n", x->tm_min);
printf("sec=[%d]\n", x->tm_sec);
return 0;
}
#include <time.h>
using namespace std;
int main(void)
{
time_t t;
struct tm *x;
time( &t );
x = localtime(&t);
printf("year=[%d]\n", x->tm_year+1900);
printf("month=[%d]\n", x->tm_mon+1);
printf("day=[%d]\n", x->tm_mday);
printf("hour=[%d]\n", x->tm_hour);
printf("min=[%d]\n", x->tm_min);
printf("sec=[%d]\n", x->tm_sec);
return 0;
}
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/962/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2008-3-24 09:18
评论列表