Get the date of next monday, tuesday, etc

前端 未结 10 1193
轻奢々
轻奢々 2020-11-29 02:24

I would like to find the date stamp of monday, tuesday, wednesday, etc. If that day hasn\'t come this week yet, I would like the date to be this week, else, next week. Thank

10条回答
  •  孤街浪徒
    2020-11-29 03:04

    Sorry, I didn't notice the PHP tag - however someone else might be interested in a VB solution:

    Module Module1
    
        Sub Main()
            Dim d As Date = Now
            Dim nextFriday As Date = DateAdd(DateInterval.Weekday, DayOfWeek.Friday - d.DayOfWeek(), Now)
            Console.WriteLine("next friday is " & nextFriday)
            Console.ReadLine()
        End Sub
    
    End Module
    

提交回复
热议问题