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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB.net get previous date

Reply to Message Icon

Name: stroke6463
Date: September 7, 2006 at 06:08:05 Pacific
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.



Sponsored Link
Ads by Google

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

Nevermind got it.

offset = -1

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


0

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

Or better yet:
offset = -1

NewDate = DateTime.Today.AddDays(offset)

-SN


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







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


Sponsored links

Ads by Google


Results for: VB.net get previous date

Help with Date in VB.net www.computing.net/answers/programming/help-with-date-in-vbnet/14259.html

Trying to get App.Path in VB.Net www.computing.net/answers/programming/trying-to-get-apppath-in-vbnet/9372.html

vb.net setup overwrite a vb6 setup www.computing.net/answers/programming/vbnet-setup-overwrite-a-vb6-setup-/13050.html