473,396 Members | 2,010 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,396 software developers and data experts.

DateTime.now - 30 (days)

Hi,

I want to get the current date minus 60 days, how can i do that.
This is what i have /want:

DateTime now = DateTime.Now;

Result = DateTime.Now.ToString("yyyyMMdd") + "')-60;

it must also work when the current date is in January.

Any tips are welcome.

Groetjes Rene.
Sep 16 '08 #1
2 35572
DateTime newDate = DateTime.Now.AddDays(-60);

Sep 16 '08 #2
Clint schreef:
DateTime newDate = DateTime.Now.AddDays(-60);
Great, that works !!

groetjes, Rene
Sep 16 '08 #3

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

Similar topics

5
by: Robert Brewer | last post by:
Anyone else tired of typing date-addition logic when iterating? It would be nice if the datetime package had something like: def iterdates(first, last): for day in range((last - first).days +...
4
by: John Hunter | last post by:
>>> from datetime import date >>> dt = date(1005,1,1) >>> print dt.strftime('%Y') Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: year=1005 is before 1900; the...
2
by: PK9 | last post by:
I have a loop where I need to calculate a series of dates based on: 1) a start date (DateTime variable) 2) a number of days (integer variable) I need to take the start date, then add the number...
2
by: Mike | last post by:
I have an ASP.NET form(using C#) with several text boxes and when the user places a date in the first textbox and clicks a button, I would like to populate the remaining textboxes with various...
10
by: David P. Donahue | last post by:
Can anyone think of an easy way to take two DateTime values and calculate, with double precision, how many semi-monthly (the first and the fifteenth) pay periods occur between them? I started...
4
by: Lad | last post by:
In a datetime object I would like to change days and hours. Or in other words, I would like to copy this datetime object but increase days and hours. Is it possible? For example:If I have a...
5
by: Lad | last post by:
Hello, what is the best /easest way how to get number of hours and minutes from a timedelta object? Let's say we have aa=datetime.datetime(2006, 7, 29, 16, 13, 56, 609000)...
5
by: mroeloffs | last post by:
Hi I have a time in microseconds, for example 0x8C905CBA7F84AF4. I want this to a normal view in hh:mm:ss DD:MM:YYYY. I tried with datetime, but it only takes a max of 1000000 microseconds is there...
2
by: O.B. | last post by:
Does C# provide an operation for converting year and day-of-the-year (1-365) to a DateTime object?
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...

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.