我正在尝试在表单上显示当天+ - 6天(上周,当前周),例如,今天的日期是18日,星期五,代码应显示
18 Friday,
19 Saturday,
20 Monday,
21 Tuesday,
22 Wednesday,
23 Thursday
And the previous week with days
11,12,13,14,15,16,17
我所尝试的是以下显示当前日期和日期
'Define the variables
Dim MyDay As Integer, MyMonth As Integer, MyYear As Integer, TheDate As Date, _
TheDayOfWeek As Integer, DayStr As String
'Convert the day of the current Date to a number
MyDay = Day(Date)
'Get the Month of the current Date
MyMonth = Month(Date)
'Get the Year of the current Date
MyYear = Year(Date)
'Convert the three above numbers to a date
TheDate = MyMonth & "/" & MyDay & "/" & MyYear
'Determine the day of the week
TheDayOfWeek = Weekday(TheDate)
'Assign a weekday name to the number
If TheDayOfWeek = 1 Then DayStr = "Sunday"
If TheDayOfWeek = 2 Then DayStr = "Monday"
If TheDayOfWeek = 3 Then DayStr = "Tuesday"
If TheDayOfWeek = 4 Then DayStr = "Wednsday"
If TheDayOfWeek = 5 Then DayStr = "Thursday"
If TheDayOfWeek = 6 Then DayStr = "Friday"
If TheDayOfWeek = 7 Then DayStr = "Saturday"
MsgBox DayStr & MyDay
答案 0 :(得分:2)
您可以使用WeekdayName获取当天的名称。
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
答案 1 :(得分:0)
使用DateAdd("d",x,MyDate)
获取距离x
MyDate
天的日期(x可以为负数)。
使用Format(MyDate,"d dddd")
格式化示例中的日期。