兩種方式自己選用
專注于為中小企業(yè)提供成都網(wǎng)站建設、網(wǎng)站建設服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)禹王臺免費做網(wǎng)站提供優(yōu)質(zhì)的服務。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了上千多家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設實現(xiàn)規(guī)模擴充和轉(zhuǎn)變。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String
s = DateTime.Today.Year()
s = s DateTime.Today.Month()
s = s DateTime.Today.Day()
s = s DateTime.Now.Hour()
s = s DateTime.Now.Minute()
s = s DateTime.Now.Second()
MsgBox(s, vbDefaultButton1, Now())
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim s As String
s = Format(Now(), "yyyymmddhhmmss")
MsgBox(s, vbYes, Now())
End Sub
C#
string [] Day=new string []{"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
Console.WriteLine(Day[Convert.ToInt16(DateTime.Now.DayOfWeek)]);
相信VB.net的你,應該懂的。
Dim ThisDay As String = Format(Now, "yyyy-MM-dd") '獲得當前日期字符串
Dim ThisDateTime As DateTime = Convert.ToDateTime(ThisDay) '當前日期轉(zhuǎn)換成DateTime
Dim ThisWeekDay As Integer = ThisDateTime.DayOfWeek '獲得當前日期是星期幾
Dim differadd As Integer = 1 - ThisWeekDay '相差的天數(shù)(星期1與當前星期幾相差的天數(shù))
Dim MyAdd As New TimeSpan(differadd, 0, 0, 0)
Dim MyYear As Integer = Format(Now, "yyyy") '獲取當前日期的年份
Dim MyMonth As Integer = Format(Now, "MM") '獲取當前日期的月份
Dim MyDay As Integer = Format(Now, "dd") '獲取當前日期是幾號
Dim MyToday As DateTime = New DateTime(MyYear, MyMonth, MyDay)
Dim Yourday As DateTime = MyToday.Add(MyAdd)
MsgBox("本周星期一的日期是:" Yourday)
1
string[] Day = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
string week = Day[Convert.ToInt32(DateTime.Now.DayOfWeek.ToString("d"))].ToString();
this.lbDay.Text = week;
2
this.lbDay.Text = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek);
不是 有 函數(shù)嘛?
now() 就是 吧
取得 后 再 分離出你所需的,分別賦值 就行了,當然 還是 有 函數(shù)的
文章標題:vb.net獲取星期天 vb獲取時間
文章來源:http://aaarwkj.com/article48/docppep.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供、網(wǎng)站制作、自適應網(wǎng)站、域名注冊、網(wǎng)站營銷、做網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)