473,467 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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.subtract(txtnumberofdays.text)

is this possible?
Sep 14 '06 #1
4 16385
Gabe,

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

I hope this helps,

Cor

"Gabe Matteson" <gmattesonATinqueryDOTbizschreef in bericht
news:Oq**************@TK2MSFTNGP03.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.subtract(txtnumberofdays.text)

is this possible?

Sep 14 '06 #2
YES! THANKS!

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uP**************@TK2MSFTNGP02.phx.gbl...
Gabe,

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

I hope this helps,

Cor

"Gabe Matteson" <gmattesonATinqueryDOTbizschreef in bericht
news:Oq**************@TK2MSFTNGP03.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.subtract(txtnumberofdays.text)

is this possible?


Sep 14 '06 #3
Cor Ligthert [MVP] wrote:
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.
Sep 15 '06 #4
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:ee**********@south.jnrs.ja.net...
Cor Ligthert [MVP] wrote:
>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.

Sep 15 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: dlx_son | last post by:
Here is the code so far <form name="thisform"> <h3>Enter time to add to or subtract from:</h3> (If not entered, current time will be used)<br> Day: <input name="d1" alt="Day of month"...
3
by: Bob Stearns | last post by:
I have a column which is the relative day number to give a treatment on. For a particular patient, where I know the starting date, how do I show the actual date for each relative day? the best I...
2
by: Cyber Clone via DotNetMonster.com | last post by:
Hello All, i want to know how to date different in csharp. i can datediff in vb6. is there any simple command for date different (CSharp)? thanks Cyber Clone
10
by: Trapulo | last post by:
Why Now.Date.Subtract(New Date(2000, 1, 1)).Days returns 731529?? It is a too big value a think! I aspect something as 1030-1100....
5
by: Simon Dean | last post by:
Probably being a little thick here, but when you subtract one date away from another, how do you convert the resultant value into a number of days... I guess I could easily / 60 / 60 / 24... but...
17
by: Terry Jolly | last post by:
New to C# ---- How do I convert a Date to int? In VB6: Dim lDate as long lDate = CLng(Date) In C#
4
by: YardDancer | last post by:
Dear All, I am upgrading my skills from VB 6.0 to VB.Net. They say you can do all date and time calculations using the properties and methods of DateTime structure withour recourse to the...
3
by: scan87 | last post by:
Hello everyone, I have a problem with my PHP code. I want to add specific number of days to the current date, so that it will display the correct date after adding the number of days to the...
2
by: Benniit | last post by:
I'm using vb.net 2008 and sqlserver 2008 and I want subtract a date from a specified date. Example: I want to subtract Commencedate from Today's Date but when I used datediff it gave me (argument...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.