Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module DateTimeExtensions
- <Extension()>
- Function AddHalfMonth(ByVal dt As DateTime) As DateTime
- Dim daysInMonth As Integer = System.DateTime.DaysInMonth(dt.Year, dt.Month)
- If daysInMonth Mod 2 = 0 OrElse dt.Day < daysInMonth / 2 Then
- Return dt.AddDays(daysInMonth / 2)
- End If
- Return dt.AddDays((daysInMonth + 1) / 2)
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement