-1

vb.netで誕生日の年を現在の年に変更するには?

たとえば、私の誕生日は 1990 年 2 月 14 日です --> 2013 年 2 月 14 日

しかし、変更する日は、2/20 の日付に変更するように 2/14 ではないため、現在の日付には等しくありません。

誕生日の年を現在の年に変更するにはどうすればよいですか?

4

2 に答える 2

0

AddYearsDateオブジェクトのメソッドを使用してこのようなことを試してください

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 に答える