用VB修改系统日期?

已举报 回答
用VB修改系统日期?
问在线客服
扫码问在线客服
  • 回答数

    7

  • 浏览数

    6,741

7个回答 默认排序
  • 默认排序
  • 按时间排序

已采纳
添加一个Timer1,Timer1.Interval = 15000'15秒

Private Sub Timer1_Timer()
Date = DateValue(2010-10-1)'或:Date = 2010-10-1
End Sub
取消 评论
我是 Windows 8。DateTimePicker 控件有个 Format 属性,改为 Custom,然后可以修改 CustomFormat 改变它的显示格式。你是不是改这里来着?
取消 评论
Print Format(Now, yyyy年mm月dd日)
用这个格式控制就可以控制程序本地的输出效果
Format函数

Dim MyTime, MyDate, MyStr
MyTime = #17:04:23#
MyDate = #January 27, 1993#

' 以系统设置的长时间格式返回当前系统时间。
MyStr = Format(Time, Long Time)

' 以系统设置的长日期格式返回当前系统日期。
MyStr = Format(Date, Long Date)

MyStr = Format(MyTime, h:m:s) ' 返回 17:4:23。
MyStr = Format(MyTime, hh:mm:ss AMPM) ' 返回 05:04:23 PM。
MyStr = Format(MyDate, dddd, mmm d yyyy) ' 返回 Wednesday, Jan 27 1993。
取消 评论
控制面板中,短日期格式是yyyy-M-d“,难道不能改成yyyy/M/d“吗?
取消 评论
Dim CustomCulture As CultureInfo = New CultureInfo(en-us)
'Date format
CustomCulture.DateTimeFormat.ShortDatePattern = yyyy年M月d日
CustomCulture.DateTimeFormat.LongDatePattern = yyyy年M月d日
'apply to application
System.Windows.Forms.Application.CurrentCulture = CustomCulture
System.Threading.Thread.CurrentThread.CurrentUICulture = CustomCulture
'另外,在改之前保存用户设定,程序执行完了,别忘了改回用户原来的设定
取消 评论
需要使用API函数:SetSystemTime ,这个函数的功能是设置当前的系统时间。
函数声明:
Delart Function SetSystemTime Lib keme132 Alias SetSystemTime(lpSystemTime As SYSTEMTIME) As Long
直接调用SetSystemTime函数,其中lpSystemTime是被新指定的系统时间,例如:
X = SetSystemTime(CDate(Text1.Text))
取消 评论
date now 都可以
取消 评论
ZOL问答 > 用VB修改系统日期?

举报

感谢您为社区的和谐贡献力量请选择举报类型

举报成功

经过核实后将会做出处理
感谢您为社区和谐做出贡献

扫码参与新品0元试用
晒单、顶楼豪礼等你拿

扫一扫,关注我们
提示

确定要取消此次报名,退出该活动?