如何知道今天是本月的哪个星期一、星期二、星期三等(数字)?

How to know today is which Monday, Tuesday, Wednesday, etc. (in number) of this month?

我的问题是:

今天的星期三和日期是:2016 年 6 月 8 日,星期三。我想知道今天是本月的哪个星期三(例如第 2 个星期三)。我如何使用 VB .NET 执行此操作?

我已经尝试过以下提供的解决方案:

How do I get first, second or last Tuesday (or any day of the week) of a given month

此解决方案接受 "Name of the Day" 和 "Week Number of the Day" 并提供输出作为日期。我想要不同的结果,因为我应该输入日期,结果应该是 "Day Number of the Day" 和 "Current Day Name",比如 "Today is 2nd Wednesday".

非常感谢任何帮助。

试试这个:

    Sub Main()
        Dim checkDate As DateTime = DateTime.Now

        Dim infos As New Dictionary(Of Integer, String)() From {{1, "st"}, {2, "nd"}, {3, "rd"}, {4, "th"}, {5, "th"}}
        Dim dayCount As Integer = (checkDate.Day \ 7) + Convert.ToInt32((checkDate.Day Mod 7) > 0)
        Console.WriteLine("Today is the {0}{1} {2} of the month", dayCount, infos(dayCount), checkDate.DayOfWeek)

        Console.ReadLine()
    End Sub

最短路线?

    ' 1st: You would need this:
    Dim numbers() As String = {"1st", "2nd", "3rd", "4th", "5th"}
    For day As Integer = 1 To 30
        Dim dat As DateTime = New DateTime(2016, 6, day)

        ' 2nd: The loop was only for test purposes
        Console.WriteLine("Today is {0} {1}", numbers(day \ 7), dat.DayOfWeek.ToString())
    Next day