Click to See Complete Forum and Search --> : yesterday's date?


meenakshi_joshi09
April 26th, 2006, 06:20 AM
Hi,
In my application I want to get the data of yesterday, can anyone tell me how can I get yesterday's date.
I am trying to decrement current date by 1, but it's giving me error of
type-casting.

"Invalid cast from DateTime to Int32."

Shuja Ali
April 26th, 2006, 06:31 AM
How about adding a -1?
Dim yesterdayDate As Date
yesterdayDate = Date.Now.AddDays(-1)
MessageBox.Show(yesterdayDate.ToString)

meenakshi_joshi09
April 27th, 2006, 02:23 AM
Thanks Shuja
for your help, your code is working nicely.