码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2015-04-08 06:35:41      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:

#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;
}

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

标签:

原文地址:http://www.cnblogs.com/tianxia2s/p/4401174.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!