我试过了:
txtyrs.text = datediff(datetimepicker1,datetimepicker2)
它不起作用.
Dim date1 As Date = Date.Now Dim date2 As Date = date1.AddDays(4.0#) Dim span = date2 - date1 Dim days As Double = span.TotalDays '=4
如果您想提取年份,请查看this post.