473,395 Members | 1,689 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,395 software developers and data experts.

DateTime.now - 30 (days)


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 35564
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

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 +...
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...
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...
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...
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...
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...
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)...
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...
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?
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...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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,...
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,...
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...
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...

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.