Reputation: 111
I have a DateTime variable like that:
Dim tarih2 As New DateTime( _
year(tarih3), _
month(tarih3), _
DateTime.DaysInMonth(year(tarih3), month(tarih3)))
and I need to set the day part to a specific value. How can I set day of a DateTime?
Upvotes: 0
Views: 2429
Reputation: 8878
DateTime
is immutable, so you can't change the value; you can only construct a new instance by either calling AddDays()
for a relative offset, or by using the constructor in a similar manner to that in your question:
tarih2 = new DateTime(year(tarih2), month(tarih2), newDayValue)
Upvotes: 5