Subtract Days from a Date

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gabe Matteson

    #1

    Subtract Days from a Date

    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.subt ract(txtnumbero fdays.text)

    is this possible?


  • Cor Ligthert [MVP]

    #2
    Re: Subtract Days from a Date

    Gabe,

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

    I hope this helps,

    Cor

    "Gabe Matteson" <gmattesonATinq ueryDOTbizschre ef in bericht
    news:OqWPHwB2GH A.4972@TK2MSFTN GP03.phx.gbl...
    >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.subt ract(txtnumbero fdays.text)
    >
    is this possible?
    >

    Comment

    • Gabe Matteson

      #3
      Re: Subtract Days from a Date

      YES! THANKS!

      "Cor Ligthert [MVP]" <notmyfirstname @planet.nlwrote in message
      news:uPgXaEC2GH A.1268@TK2MSFTN GP02.phx.gbl...
      Gabe,
      >
      you mean something as simple as
      Dim DateFourteenDay sAgo As DateTime = Now.AddDays(-CInt("14"))
      >
      I hope this helps,
      >
      Cor
      >
      "Gabe Matteson" <gmattesonATinq ueryDOTbizschre ef in bericht
      news:OqWPHwB2GH A.4972@TK2MSFTN GP03.phx.gbl...
      >
      >>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.subt ract(txtnumbero fdays.text)
      >>
      >is this possible?
      >>
      >
      >

      Comment

      • Phill W.

        #4
        Re: Subtract Days from a Date

        Cor Ligthert [MVP] wrote:
        you mean something as simple as
        Dim DateFourteenDay sAgo As DateTime = Now.AddDays(-CInt("14"))
        Or even

        Dim DateFourteenDay sAgo As DateTime = Now.AddDays(-14)

        ??

        Regards,
        Phill W.

        Comment

        • Cor Ligthert [MVP]

          #5
          Re: Subtract Days from a Date

          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

          "Phill W." <p-.-a-.-w-a-r-d@o-p-e-n-.-a-c-.-u-kschreef in bericht
          news:eee9qd$8j2 $1@south.jnrs.j a.net...
          Cor Ligthert [MVP] wrote:
          >
          >you mean something as simple as
          >Dim DateFourteenDay sAgo As DateTime = Now.AddDays(-CInt("14"))
          >
          Or even
          >
          Dim DateFourteenDay sAgo As DateTime = Now.AddDays(-14)
          >
          ??
          >
          Regards,
          Phill W.

          Comment

          Working...