使用vb.net更改计算机日期 [英] Change Computer date using vb.net

查看:90
本文介绍了使用vb.net更改计算机日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用vb.net更改计算机日期和时间.我想让客户端与服务器日期保持一致.如果不相同,我会更改客户日期..

How can i be able to change the computer date and time using vb.net. I want to compaire Client with the server date. if not the same the i change the client date..

推荐答案

Private Structure <StructLayout(LayoutKind.Sequential)> SYSTEMTIME
Public wYear As Short
Public wMonth As Short
Public wDayOfWeek As Short
Public wDay As Short
Public wHour As Short
Public wMinute As Short
Public wSecond As Short
Public wMilliseconds As Short
End Structure
Private Declare Function SetSystemTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME) As Boolean
Dim lpSystemTime As SYSTEMTIME


填充结构并调用SetSystemTime(lpSystemTime)


Fill the structure and call SetSystemTime(lpSystemTime)


这篇关于使用vb.net更改计算机日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆