473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

DateAdd

Hello:

I know DateAdd is not a part of the C# language: but I can't seem to figure
out how to implement the same funtionality. I want to be do something like:

dDate = DateAdd(-1, dResquestedDate)

where -1 is the number of days I would like to add
dRequestedDate is the date I would like to add days to.

Would anyone be able to provide some insight or help?

Thanks
Andy
Nov 16 '05 #1
3 40883
A> I know DateAdd is not a part of the C# language: but I can't seem to
A> figure out how to implement the same funtionality. I want to be do
A> something like:
A>
A> dDate = DateAdd(-1, dResquestedDate)

dDate = dRequestedDate + new TimeSpan(...) ?

--
Serg
Nov 16 '05 #2
Try something like:
DateTime today = DateTime.Now;
DateTime yesterday = today.AddDays(-1);
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Andy" <An**@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
Hello:

I know DateAdd is not a part of the C# language: but I can't seem to
figure
out how to implement the same funtionality. I want to be do something
like:

dDate = DateAdd(-1, dResquestedDate)

where -1 is the number of days I would like to add
dRequestedDate is the date I would like to add days to.

Would anyone be able to provide some insight or help?

Thanks
Andy

Nov 16 '05 #3
SB
http://msdn.microsoft.com/library/de...classtopic.asp

-sb

"Andy" <An**@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
Hello:

I know DateAdd is not a part of the C# language: but I can't seem to
figure
out how to implement the same funtionality. I want to be do something
like:

dDate = DateAdd(-1, dResquestedDate)

where -1 is the number of days I would like to add
dRequestedDate is the date I would like to add days to.

Would anyone be able to provide some insight or help?

Thanks
Andy

Nov 16 '05 #4

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

Similar topics

5
by: lofty | last post by:
Dear Lord, I'm trying to code a drop down for a date entry that gives the user the option of the current date plus the dates of the last 7 days. <% for i = -7 to -1 Response.write...
4
by: Øyvind Isaksen | last post by:
Hi! I need to add 1 day to a specific date. The date have is stored in a variable called "DateOld". The value of the variable have this syntax: mm.dd.yyyy. The new date is the variable called...
9
by: Brandon | last post by:
Greetings, I am having a problem getting a SQL statement that is functional in Access 2K to work in ASP. My Access SQL statement is this: SELECT DateAdd('s',Ticket_Opened_Date,'Dec 31, 1969...
0
by: Zlatko Matiæ | last post by:
I am currently migrating from MSDE to PostgreSQL and have to rewrite the function that is calculating next date of sampling... In MSDE there is a DateAdd function. I can't find the appropriate...
1
by: Raghu | last post by:
Hello... I am running into a problem while running a query..can some1 help.. this is the query : ************** SELECT * from Table S where S.dtDate1 BETWEEN...
2
by: Abdul N K | last post by:
I need help in T-SQL. I am using DATEADD function and I want to add 6 months to a date. But it does not return me the rusults, which I want e.g. SELECT DATEADD(m,'20040630') returns 20041230...
3
by: Annette Massie | last post by:
I am trying to insert a record into a table via code and one of the values to add I would like as a dateadd calculation on a value from a query. My code looks like this: Set db = CurrentDb() ...
4
by: ey.markov | last post by:
Greetings, I have an A2K application where for a report the user enters a month-end date, and the system must gather transactions for that month. No problem, I thought, I'll just use the DateAdd...
1
by: C.Davidson | last post by:
Does subject VB.net 2003 support DateAdd function? I have tried to implement the following without success. In my example I tried to simply add 30 months to 9/18/2003 and I get "New date: 12:00:00...
2
by: Rich Raffenetti | last post by:
I have the following code. If I do the dateadd function with dateinterval.minute, it works fine and the date/time value is displayed with zero seconds. If I do the dateadd function with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
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,...

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.