Browse DevX
Sign up for e-mail newsletters from DevX

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



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

Determine Date Format on the Server

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.


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.



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