通过C++修改系统时间代码

#include <windows.h>
#include <stdio.h>
#include <iostream>
using namespace std;
int main( void )
{
SYSTEMTIME sys;
GetLocalTime( &sys );
printf( "%4d/%02d/%02d %02d:%02d:%02d.%03d 星期%1d\n",sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute, sys.wSecond,sys.wMilliseconds,sys.wDayOfWeek);
//sys.wYear
//sys.wMonth,
//sys.wDay,
sys.wHour = 2;
sys.wMinute =0;
sys.wSecond = 0;
sys.wMilliseconds = 0;
sys.wDayOfWeek = 1;
SetLocalTime( &sys );
cout<<"System now time is: ";
printf( "%4d/%02d/%02d %02d:%02d:%02d.%03d 星期%1d\n",sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute, sys.wSecond,sys.wMilliseconds,sys.wDayOfWeek);
return 0;
}

上一篇:HTML学习笔记【思维导图版】


下一篇:ASP.NET MVC为字段设置多语言显示 [转]