Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Format

Status
Not open for further replies.

paulcarey

Programmer
Jun 15, 2001
45
GB
I looked through all the posts ad haven't been able to solve my problem. It's the usual UK/US date problem.

My regional settings on the server are UK.
The date is beng input to the database as UK but no matter what formatting I try I cannot get it to display from the database as UK ie(dd/mm/yy).

???????

paul
 
Try this first...

In your SQL statement where you are querying your date change it to read:

CONVERT(char(113), create_date)
(where 'create_date' is the name of your date column)

This will convert it to European date format. For more info search for CONVERT in Books Online. It tells you what all the other conversion codes are - 113 might not be the one you're after.

Come back if this doesn't work - there are various other workarounds. Unfortunately, when building SQL, Microsoft didn't believe that some people actually live outside the US and Canada! :)

Hope this helps.

Craig
 
Craig

Thanks for that! Do you mean in the SQL that retrieves to display or to input. Ive tried in the display mode and it just killed the server.

sql="SELECT system, Status, StatusText, CONVERT(char(113),StatusDate), StatusTime FROM tblSystemStatus Order by System asc"
 
I use the script below to format dates.

Dim strDate, Qarray, dd, mm, yy
Qarray = Array(2)
strDate = rsYourRecord("yourdatefield").value
Qarray = split(strDate, "/", -1)
mm = Qarray(0)
dd = Qarray(1)
yy = Qarray(2)
strDate = (dd + "/" + mm + "/" + yy) The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top