I need a VBScript function that will format a date as mm/dd/yyyy. The FormatDateTime function does not give me this option and the CDate function wants to convert everything into mm/dd/yy. How can I do this?
You can do this one of two ways. First, you can set the Short Date settings on your server to mm/dd/yyyy. Then call FormatDateTime passing the argument vbShortDate. (Remember, vbShortDate = 2).
Second, you can write your own function to parse out a date and return it as mm/dd/yyyy. You can use the DatePart function to obtain the month, day, and year, and then put them together, ensuring that the format is in the way you want it.