- Blitz wrote:
Heres what I have tried:
Field type: Date
Problem: Forces into US format but I need it in UK
NOT TRUE! In MySQL, *all* DATE and DATETIME fields are stored in YYYY-MM-DD hh:mm:ss format *internally*. True, if you use a database tool to execute queries, you may find that the *TOOL* (not MySQL!) converts that internal format to USA format. JUST IGNORE THAT!
In ASP code, when you retrieve a date or datetime value from MySQL, it is converted into a VBScript date type (actually VT_DATE in the underlying COM implementation).
So all you need to do is *DISPLAY* that in UK format. And you can do that easily by setting the Session.LCID to UK!
Whatever you do, do *NOT* store dates and times in VARCHAR fields. You *WILL* come to grief.
So...
- Code:
-
<%
Session.LCID = 2057 ' use UK standard settings
...
sql = "SELECT * FROM Availability ORDER BY av_Date"
Set RS = yourOpenConnection.Execute( sql )
Do Until RS.EOF
Response.Write RS("av_Date") & "<br>" & vbNewLine
RS.MoveNext
Loop
RS.close
%>
Here's something I wrote many years ago. It discusses Access database, but aside from the internal format used everything it says applies to MySQL:
http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=189