Trying to format a date that might be less than todays date in VB2010.
To determine what date I want I use:
This works and returns a value of yesterdays date in the format of m/dd/yy. I am trying to get the format of "yyyymmdd"Code:dim TheDate as date TheDate = Today.AddDays(-1)
When ever I try to change the format:
I get an error about casting a number, the value must be less than infinity. I think yesterday should be < infinity, but I still get the error.Code:TheDate = format(Today.AddDays(-1), "yyyymmdd")
Any idea how subtract a day from today and put it in a different format? I see lots of examples of each component on the web, but not both at the same time.


Reply With Quote