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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Date format 1

Status
Not open for further replies.

junket

Programmer
May 5, 2001
7
0
0
AU
I am creating a web site in Australia for Australians, and require users to add their date of birth.

Australian standard date format is d/m/y compared to US m/d/y. My site is hosted in the US, therefore the servers default settings are US and the access db looks at the regional setting for the date format.

When writing to the database from an ASP script (which is what I'm doing), if the user has entered a date in OZ format, eg: 4/6/2000 (4th of June, 2000) the db interprets that as April 6th, 2000.
Even more of a problem is that if the date entered is impossible in US format, eg: 15/6/2000, it converts it on entry so when retrieved it is displayed as 6/15/2000.

I know that I could specify on the page that the date needs to be entered in a specific way (US!), but would love to know if I can get the dates entered and returned in OZ format.
Any ideas?
 
The following code will return the format as defined by the users pc.
Function GetDateFormat() As String
'Routine returns user format for dates
On Error Resume Next
Select Case Left(CStr(DateSerial(1995, 12, 31)), 2)
Case "12"
GetDateFormat = "mm/dd/yyyy"
Case "31"
GetDateFormat = "dd/mm/yyyy"
Case Else
GetDateFormat = "yyyy-mm-dd"
End Select
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top