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

Help with date issue

Hi,
How can I get six month prior to the current date using

Now.Today.ToShortDateString

so if Now.Today.ToShortDateString returns 11/22/2004 I need 06/22/2004.

Thanks
Nov 18 '05 #1
2 878
On Mon, 22 Nov 2004 19:51:02 -0800 in
microsoft.public.dotnet.framework.aspnet, "Chris"
<Ch***@discussions.microsoft.com> wrote:
Hi,
How can I get six month prior to the current date using

Now.Today.ToShortDateString

so if Now.Today.ToShortDateString returns 11/22/2004 I need 06/22/2004.

Thanks


// Subtract 6 months from today's date
DateTime dt = DateTime.Now.AddMonths(-6);

Roger

Nov 18 '05 #2
Chris,

Try this:

Now.AddMonths(-6).ToShortDateString()
or
Now.AddMonths(-6).ToString("d")

Regards,
Ian Suttle
http://www.IanSuttle.com

"Chris" wrote:
Hi,
How can I get six month prior to the current date using

Now.Today.ToShortDateString

so if Now.Today.ToShortDateString returns 11/22/2004 I need 06/22/2004.

Thanks

Nov 18 '05 #3

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

Similar topics

2
by: Ben | last post by:
The page below isn't picking up details or location. What have I missed? Thanks in advance, Ben ____________________________________________ <?PHP
2
by: Evelyn Pabón | last post by:
Hi I'm developing a database with access and I was ask to include in the report the date of issue. But if the date of issue was change It should be included in the footnote area the issue date...
3
by: Jay | last post by:
I previously posted this question under Visual Basic newsgroup, but was advised to re-post here. I'm hoping someone can help me solve an issue I'm having with VB.Net and Access 2000. Here's...
3
by: Abhas | last post by:
> > Hi, this is Abhas, > > I had made a video library program in C++, but was facing a problem. > > After entering 12 movies, i cannot enter any more movies. > > Something gibberish comes instead....
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
10
by: Elizabeth Harmon | last post by:
Hi All I am attempting to open a Word App from a web page on the client and so far everything works (After reconfig of dcomcnfg for Microsoft Word Document). I have one minor problem, i cannot...
17
by: Liam.M | last post by:
Hey guys, Forgive me if my question my be alittle silly, but I would very much appreciate and assistance that could be given! My situation is as follows: I have created a Button, and set...
6
by: D | last post by:
Hello all...I have an issue with one of my java script functions that I'm hoping someone can easily help with. I have a web based application that we use to create/sign up for overtime. When we...
5
jenkinsloveschicken
by: jenkinsloveschicken | last post by:
Could someone please take a look at my query and tell me what I am missing? The strange thing is that when I first built the query, it was working fine. Then it broke. I suspect the problem is the...
1
by: nigelesquire | last post by:
I am in need of your assistance. I have a page with multiple unixtime stamps and I need to display them in readable time and date with the user's time zone. Below is the code. <!DOCTYPE...
0
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...
0
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...
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: 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
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
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...
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...

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.