Dates are rendered on your asp page in the format of the servers local settings. IME it does not matter what this format is. You should always wrap functions around all dates rendered on a page. Even if your server is set to dd/mm/yyyy still wrap functions around them. This way your pages are more portable. You may think your pages will not be placed on another server, but, why take the risk!!!
Anyhow here are some functions I use day in day out:
This one will always give you dd/mm/yyyy (au is short for Australian):
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)) & ""
END IF
END FUNCTION
Another useful one I use all the time (Example output 13 Feb 2006). EG:
function customDate(varDate)
if isNull(varDate) OR Trim(varDate) = "" OR varDate = "Null" THEN
customDate = "Null"
else
'customDate = "155 Jun 2006"
customDate = Day(DateValue(varDate)) & " " & MonthName(DatePart("m", varDate), True) & " " & year(varDate)
'customDate = Day(varDate) & " " & MonthName(DatePart("m", varDate), True) & " " & year(varDate)
end if
end function
You can see from these functions a date can be presented in any fashion regardless of the servers, or local settings. Place these in a global functions file, every time you render a date, use them.
Wind is your friend
Matt
|