|
-
Aug 19th, 2012, 12:59 PM
#1
Thread Starter
New Member
Formatting different dates
Trying to format a date that might be less than todays date in VB2010.
To determine what date I want I use:
Code:
dim TheDate as date
TheDate = Today.AddDays(-1)
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"
When ever I try to change the format:
Code:
TheDate = format(Today.AddDays(-1), "yyyymmdd")
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.
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.
-
Aug 19th, 2012, 01:19 PM
#2
Re: Formatting different dates
Well a coupla things,
Format is a string function so you can't get a date out of it though it does work perfectly as a string ..... 20120818
mm is minutes, MM is months!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|