1、可以获取数据库时间
http://www.foxtable.com/webhelp/scr/2318.htm
2、获取互联网时间
Dim url As String = "http://api.k780.com/?app=life.time&appkey=29911&sign=979fa2b6ab36dbe291bbd12e5c6db870&format=json"
Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url)
Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse
Dim stm As System.IO.Stream = rsps.GetResponseStream()
Dim reader As New System.IO.StreamReader(stm)
Dim str As String = reader.ReadToEnd
stm.Dispose()
Output.Show(str)
Dim data As object
Dim JscriptCode = "function toObject(json) {eval(""var o=""+json);return o;}"
Dim ScriptControl = CreateObject("MSScriptControl.ScriptControl")
With ScriptControl
.Language = "Javascript"
.Timeout = -1
.AddCode(JscriptCode)
data = .Run("toObject", str)
End With
Dim d As Date = data.result.datetime_1
msgbox(d)
'Today = d '设置系统时间
'TimeOfDay = d
3、可以做一个防止作弊的功能。保存系统每次获取到的日期,比如人家设置成2月23日了,然后再设置回2月6日,(对比最大的日期和当前日期)提示他作弊了,禁止再打开项目。