我想知道是否有办法直接将DayOfWeek返回的整数转换为表示星期一,星期二等日期的字符串.
示例代码:
MessageBox.Show(Date.Today.DayOfWeek)
这将返回6(截至今天).例如,有没有办法将其直接转换为星期六?我真的不关心它真正转化为什么,但我想取消我的Select Case:
Select Case Date.Today.DayOfWeek Case 0 day = "Sunday" Case 1 day = "Monday" Case 2 day = "Tuesday" Case 3 day = "Wednesday" Case 4 day = "Thursday" Case 5 day = "Friday" Case 6 day = "Saturday" Case Else day = "Apocalypse: we're all boned." End Select
谢谢 :)
一种更简单的方法:
原文链接:https://www.f2er.com/vb/255547.htmlDim day As String = Date.Today.DayOfWeek.ToString()