-1

How to change the year of your birthday to current year in vb.net?

example my birthday is 2/14/1990 --> 2/14/2013

but the day you change is not 2/14 like you change it to the date of 2/20 so its not equal to the present day.

How can i change my birthday year to current year?

4

2 回答 2

0

AddYears使用Date 对象的 Method尝试这样的事情

Dim myBirthday As Date = Date.Parse("2/14/1990")
myBirthday = myBirthday.AddYears(23)
于 2013-03-02T02:11:52.580 回答
0

我的分分钱

    'what about leap years
    Dim myBirthday As DateTime = #2/29/2000#

    'the following doesn't work 
    ' Dim myBirthdayThisYear As DateTime = New DateTime(DateTime.Now.Year, myBirthday.Month, myBirthday.Day)

    'this works
    Dim myBirthdayThisYear As DateTime = DateSerial(DateTime.Now.Year, myBirthday.Month, myBirthday.Day)
于 2013-03-02T14:05:34.347 回答