-
I'm having great trouble with entering dates onto my web page that will then send the information to my SQL database.
I want to be able to enter in the format of dd/mm/yy
But this keeps returning errors.
So I tried mm/dd/yy and this works fine, but whe redisplay on the web it comes out as mm/dd/yy, which is no good to me.
I really would like to display it as dd/mm/yyyy.
How can I achieve this as its really starting to bug me.
-
the reaon this is happening is becuase sql server get's it information from the local settings of the server. the actual computer that has sql running on it will be set up as american or the likes.
To change it go into control panel in windows and click on regional settings and make sure the local is English(United Kingdom).
If you haven't got access to this (ie your using an ISP)
I dont think you can do much about it as the formatdatetime function uses it ingormation from the local system as well
hope this helps
Ian
-
You could make yourself your own date formatting function using the Day(), Month(), and Year() functions. It might look something like this:
Code:
<%
Function DisplayDate(DateValue)
Dim strReturn
Dim strDay
Dim strMonth
strDay = Day(DateValue)
If Len(strDay) = 1 Then
strDay = "0" & strDay
End If
strMonth = Month(DateValue)
If Len(strMonth) = 1 Then
strMonth = "0" & strMonth
End If
strReturn = strDay & "/" & strMonth & "/" & Year(DateValue)
DisplayDate = strReturn
End Function
%>
And call is from within your ASP code like so:
Code:
Response.Write "<P>" & DisplayDate(Date) & "</P>" & vbcrlf
Cheers,
Paul