如何获取datetimepicker中的星期数就像在Mysql中一样只使用函数WEEK() 它会返回周数,就像那样简单。
例如
datetimepicker1.text = "9/9/2014"
'returns 36
just like in mysql. example.
WEEK(9/9/2014)
`returns 36
答案 0 :(得分:3)
Dim dt = datetimepicker1.Value
Dim dateInfo = Globalization.DateTimeFormatInfo.CurrentInfo
Dim c = dateInfo.Calendar
Dim week = c.GetWeekOfYear(dt, dateInfo.CalendarWeekRule, dateInfo.FirstDayOfWeek)