VBScript - Need to verify a date and add leading zeros if needed
Posted on 2011-03-18
This needs to be done in VBScript so I can use it in an ASP page
I have a database that gets a little wonky due to so many people acessing it. Before I run a specific report I need to check the database and replace any missing leading zeros.
For example all dates should be formatted like:
However, the data is actually formatted as text and not "dates" .
(That should make it even easier)
The trouble is that I have worked on this for a while and can't come up with a working solution, it's like I have a block in my brain or something, I know it's simple....and it's killing me.
I am currently using a SQL statement to select out records with a length of 7 and adding a leading zero and updating in a loop and it works for most but that doesn't work for 01/7/11 obviously as it makes it 001/7/11
I have to select out all records that are <7 and then do a check to see where the missing zero(s) is/are