Date and Time

bokaraton
01-30-2006, 11:46 AM
How do I subtract one day from the current date?

example: Now() - 1 *** does not work in vb.net

SNWBRDR
01-30-2006, 12:40 PM
Maybe like this ?

sDate as string = Now.ToShortDateString
sDate.Substring(..)

bokaraton
01-30-2006, 01:04 PM
Maybe like this ?

sDate as string = Now.ToShortDateString
sDate.Substring(..)


I don't see how that will subtract one day from the current date.

IE...01/30/2006 = 01/29/2006

inighthawki
01-30-2006, 01:04 PM
i dont know if u can subtract days, but u could do

Dim _Date as Date = Now
_Date.adddays(-1) 'not sure of exact command, if its .adddays or what

once again, i dont know if u can add negetive days...

bokaraton
01-30-2006, 01:10 PM
i dont know if u can subtract days, but u could do

Dim _Date as Date = Now
_Date.adddays(-1) 'not sure of exact command, if its .adddays or what

once again, i dont know if u can add negetive days...


Great. That works.

Thanks for your help.

inighthawki
01-30-2006, 01:11 PM
no problem, we're here to help :P

reboot
01-30-2006, 01:48 PM
Dim _Date = New Date().Now.AddDays(-1)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum