Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Active Server Pages (ASP)
Expertise: Beginner
Aug 27, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Format a Date as mm/dd/yyyy

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.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date