'这个是帮助文件的方式,但有时候不是sql数据库的时候,无法使用,找了下面的方法。记录一下。
Public Function SDate() As Date
'Dim cmd As New SQLCommand
'cmd.C
'cmd.CommandText = "Select GetDate()"
'Return cmd.ExecuteScalar()
'通过http头获取服务器时间
Dim htc As new HttpClient("http://www.baidu.com")
If htc.GetInformation() Then
htc.Close() '必须执行Close方法关闭连接
Return CDate(htc.ResponseHeaders("date"))
End If
End Function