我试图从互联网上获取日期和时间,但我不知道如何做到这一点,谷歌的大部分代码都不适合我...,然后我试图从http://www.worldtimeserver.com/current_time_in_ID.aspx获取文档文本到RichTextBox这段代码:
Private Function getPageSource(ByVal URL As String) As String
Dim getWebClient As System.Net.WebClient = New System.Net.WebClient()
Dim strSource As String = getWebClient.DownloadString(URL)
getWebClient.Dispose()
Return strSource
End Function
RTBDateTime.Text = getPageSource("http://www.worldtimeserver.com/current_time_in_ID.aspx")
此块包含我所在位置的日期和时间:
<div class="desc" style="text-align: center">
<span class="font7">
4:08 PM 'this line (TIME)
</span>
<br>
<span class="font6">
Friday, November 28, 2014</span> 'and this line without "</span>" (DATE)
<br>
Waktu Indonesia Barat (West Indonesian Time) (WIB) +0700 UTC
<br>
<br>
UTC/GMT is
09:08
on
Friday, November 28, 2014 'or this line for DATE
<br>
<br>
</div>
我希望得到“4:08 PM”和“2014年11月28日星期五”..我怎样才能实现这一目标?