Subtract Days from a Date

  • Thread starter Thread starter Gabe Matteson
  • Start date Start date
G

Gabe Matteson

I want to be able to find out the names of files that have not been accessed
in the past X days...

i allow the user to put in the number of days, e.g. show all files that have
no been accessed in the past 30 days.

so i would do something like this:

dim lastaccessed as date
lastaccessed = date.today.subtract(txtnumberofdays.text)

is this possible?
 
Gabe,

you mean something as simple as
Dim DateFourteenDaysAgo As DateTime = Now.AddDays(-CInt("14"))

I hope this helps,

Cor
 
YES! THANKS!

Cor Ligthert said:
Gabe,

you mean something as simple as
Dim DateFourteenDaysAgo As DateTime = Now.AddDays(-CInt("14"))

I hope this helps,

Cor
 
Cor said:
you mean something as simple as
Dim DateFourteenDaysAgo As DateTime = Now.AddDays(-CInt("14"))

Or even

Dim DateFourteenDaysAgo As DateTime = Now.AddDays(-14)

??

Regards,
Phill W.
 
Phil,

I did that to show Gabe how to convert that textbox he was showing in his
sample.

You probably would not believe it, but I knew that what you showed.

:-)

But thanks for your contribution to this newsgroup.

And feel free to post another time, I often make mistakes.

Cor
 
Back
Top