|
-
Jul 22nd, 2007, 03:12 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] subtract a year from datetime.now
Hi all
I am trying to make a string that i can put into a sql query that will retrive one years worth of records
i have the code
System.DateTime date2 = new System.DateTime();
date2 = DateTime.Now;
textBox1.Text = date2.ToString("MM/dd/yyyy HH:MM:ss");
date2.AddYears(-1);
textBox2.Text = date2.ToString("MM/dd/yyyy HH:MM:ss");
but it just doesnt seem to be working so im thinking my addyears(-1) is wrong
can anyone give me a hint to point me in the right direction?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|