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

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


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

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Determine Date Format on the Server

Question:
Is there any way I can use ASP to get the date format on the server? I don't want to return a date and then print it. I want to know the format so that I can instruct the user to enter a date in the correct format, such as dd/mm/yy or dd/mmm/yyyy and so on.

Answer:

You can do this in one of a couple ways. First, you can create your own component DLL using VB. In the DLL, use the Windows API to read the registry settings to obtain the information. Second, you can use the FormatDateTime with short date option on the function Now:

   varD = FormatDateTime(Now, vbShortDate) ' vbshortdate = 2

Then parse through the variable varD and figure out whether it is dd/mm/yy or dd/mm/yyyy.

Also, how many times does your date format on the server change anyway? Just manually access the server and find out the format and hard code it in your ASP code. Sometimes the simplest ways are the best ways.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date