Hey guys,
I thought getting yesterday's date was now() - 1 but visual studio is giving me error saying '-' is not the right operator. I think now() - 1 was used in VB6. whats the correct way of obtaining yesterday date?
Hey guys,
I thought getting yesterday's date was now() - 1 but visual studio is giving me error saying '-' is not the right operator. I think now() - 1 was used in VB6. whats the correct way of obtaining yesterday date?
Dim Yesterday As Date = DateAndTime.DateAdd(DateInterval.Day, -1, DateAndTime.Now)
thanks but is there a shorter way of coding? shorter is easier to remember..
Remember dateadd and you'll be able to look it up (VS help or google) when you forget it.
got it... i also found the shorter easier way.
Today().AddDays([I]number_of_days(+/-)[/I])
thanks for the help guys
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.