devxlogo

VB5 – Is the Format Function Y2K Compliant

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.

See also  Small Business Strategies with Venmo
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist