Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Jul 23, 1999

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.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


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

 

 

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