testdealtime.cpp
来自「很好的编成事例大家来下吧,」· C++ 代码 · 共 44 行
CPP
44 行
// testdealtime.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include "DealTime.h"
int main(int argc, char* argv[])
{
CDealTime tm = CDealTime::GetLocalTime(); //
CDealTime tm2; //
int year = tm.GetYear();
int month = tm.GetMonth();
int day = tm.GetDay();
int hour = tm.GetHour();
int minute=tm.GetMinute();
int second = tm.GetSecond();
printf("now is %04u-%02u-%02u %02u:%02u:%02u\n",year,month,day,hour,minute,second);
//the time passed
tm2 = tm + 60*60*25;
year = tm2.GetYear();
month = tm2.GetMonth();
day = tm2.GetDay();
hour = tm2.GetHour();
minute =tm2.GetMinute();
second = tm2.GetSecond();
printf("after 60*60*25 second data is %04u-%02u-%02u %02u:%02u:%02u\n",year,month,day,hour,minute,second);
CDealTime tm3(2004,12,31,23,62,65);
year = tm3.GetYear();
month = tm3.GetMonth();
day = tm3.GetDay();
hour = tm3.GetHour();
minute =tm3.GetMinute();
second = tm3.GetSecond();
printf("tm3 is %04u-%02u-%02u %02u:%02u:%02u\n",year,month,day,hour,minute,second);
getchar();
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?