VB.Net 2005, how can I subtract a date from the (current date minus 7 days) and produce a number of days?
问题 I have a date in the future e.g. 13/10/2008 I need to subtract the current date (today is the 28/09/2010) minus 7 days, so thats 21/09/2010 minus 13/10/2008, which would equal erm, 720 something ? But the current date won't always be 28/09/2010, obviously. I need the code for this. EDIT: When i said future I mean past :) 回答1: Sub Main() Dim dt As DateTime = New DateTime(2008, 10, 13) ' be careful what you are subtracting from what ' the date you have is not in the future (year 2008) ' if the