Computing.Net > Forums > Programming > VB.net get previous date

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

VB.net get previous date

Reply to Message Icon

Original Message
Name: stroke6463
Date: September 7, 2006 at 06:08:05 Pacific
Subject: VB.net get previous date
OS: XP Pro
CPU/Ram: idk
Comment:

I am a newbie with VB.net. I am familiar with VB6 so I have some idea of how things work. I need is a program to make a program that will return a previous date. Basically when I execute the program with a "-1" and that would make it display yesterday's date. In VB6, you just could do "msgbox Date -1" but vb.net it doesn't work like that. Any suggestions? Thanks.


Report Offensive Message For Removal


Response Number 1
Name: stroke6463
Date: September 7, 2006 at 06:22:58 Pacific
Reply: (edit)

Nevermind got it.

offset = -1

NewDate = DateAdd(DateInterval.Day, offset, Today)


Report Offensive Follow Up For Removal

Response Number 2
Name: SN
Date: September 7, 2006 at 08:36:17 Pacific
Reply: (edit)

Or better yet:
offset = -1

NewDate = DateTime.Today.AddDays(offset)

-SN


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software