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

Problems formating date with FormatDateTime

Status
Not open for further replies.

Boblevien

Technical User
Nov 3, 2000
38
GB
I am trying to format dates taken from an Access database according to the local, (ie client's), Regional Settings.

According to the documentation this ought to be achieved with:
Dim DateFormat
DateFormat = FormatDateTime (objRS("date"),2)

where 2 represents a short date formated according to the local settings.

It clearly works to some extent since if I use (objRS("date"),1) I do get a long date - but it ain't in my local (UK) format.

Any ideas?

Bob Levien
 
You could use
Dim DateFormat
DateFormat = Format (objRS("date"),"mm/dd/yy")




David Paulson


 
To comply with users regional config you shouldn't use a fixed format such as "mm/dd/yy". My Regional Config for Brazil is "dd-mm-yyyy".

Try this:

Dim DateFormat
DateFormat = Format (objRS("date"),"short date")
 
Hi dgs,

I tried your suggestion, which is exactly what I'm trying to achieve, and got:

Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "short date"]'

when I ran it. Any idea why?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top