View Single Post
 
Old April 19th, 2006, 06:25 PM
mat41 mat41 is offline
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;where the user enters dates.
I choose to use a date picker. this way they can not enter dates incorrectly

;;isdate function in an asp form and this picks up any obvious errors
IMO They are not errors. End user are entering the wronf format probably because your form is clearly poorley validated.

;;I have had a look around and found that this is a fault of isdate
There is no fault in the isDate function, we all use it.

;;both dates as correct
Yes both formats are correct, so is yyyy/../...

;;;Does anybody have any date checking code that we can use that will only accept U.K dates?

you can use the following function to get dd/mm/yyyy (it is called audate because it gives me an Australian date:
FUNCTION auDate(varDate)
   IF isNull(varDate) OR Trim(varDate) = "" OR varDate = "Null" THEN
      auDate = "Null"
   ELSE
      auDate = "" & day(DateValue(varDate)) & "/" & month(DateValue(varDate)) & "/" & Year(DateValue(varDate)) & " " & TimeValue(varDate) & ""
   END IF
END FUNCTION

Use it like so (dont forget to trim all your values, a good practice):
auDate(trim(request.form("yourDateFieldname")))

The above function is very easy to tweak into what ever date format you would like





Wind is your friend
Matt