VB5 – Is the Format Function Y2K Compliant

Question:
I am using the format function to format a date entered by the user. My machine’s short date setting is mm/dd/yyyy. My OS is NT 4.0

Format(25/05/01,”Short Date”) gives me a result of 05/01/2025. Is there a way of getting it to return 05/25/2001? I am running on NT SP3. Will it help to try SP5?

Answer:
The built-in date formats are pretty poor, in my opinion. I always do my formatting with “custom” formats. If you want mm/dd/yyyy on a date, just do this:

Format(#25/05/01#, “mm/dd/yyyy”)
You won’t have to worry about the built-in settings if you do it this way.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: