Date filed in Access Database

  • Thread starter Savvas Tsitouridis
  • Start date
S

Savvas Tsitouridis

Hello

I have an Access database with a date field
The format that we store values is dd/mm/yyyy (greek)
The problem is that i can't retreive the correct dates because the queries
return only the english format dates.
How to format the query to english date format (mm/dd/yyyy)?

Thank you
 
E

Evertjan.

Savvas Tsitouridis wrote on 03 jul 2007 in
microsoft.public.inetserver.asp.general:
I have an Access database with a date field
The format that we store values is dd/mm/yyyy (greek)

NOT true, a date field is filled with an access internal numeric
representation of the date/time, so unformatted, and even comes out
unformatted.

I suppose you access that database using the jet engine under ASP-
vbscript?
The problem is that i can't retreive the correct dates because the
queries return only the english format dates.

[You perhaps mean the American one, mm/dd/yyyy, English is like yoursx
and ours]

No they do not, they are converted to the numeric representation of the
computer language you use [vbscript?]

Only if you use [the lazy way]

response.write myDate

there is an automatic conversion to the format
your own server's reginal settings provides.

Try:

<% ' vbscript

myDate = mDATA("dateField") 'or whatever your field is named
response.write myFormDate(myDate)

function myFormDate(x)
myFormDate = two(day(x)) & "/" & two(month(x)) & "/" & year(x)
end function

function two(x)
two = right("0" & x,2)
end function

%>
How to format the query to english date format (mm/dd/yyyy)?

See above.
A query does not format!
"to English"?, I do not think that is what you ment.
 
B

Bob Barrows [MVP]

Evertjan. said:
See above.
A query does not format!

Well, technically it can, via the same means your vbscript example uses:
convert the date to a string. Of course, if date arithmetic or comparisons
need to be done, the string representaion of the date needs to be converted
back to a date.

select Right("0" & Month([datefield]),2) & "/" & ...
(the rest is left as an exercise for the reader)
 
E

Evertjan.

Bob Barrows [MVP] wrote on 03 jul 2007 in
microsoft.public.inetserver.asp.general:
Evertjan. said:
See above.
A query does not format!

Well, technically it can, via the same means your vbscript example
uses: convert the date to a string. Of course, if date arithmetic or
comparisons need to be done, the string representaion of the date
needs to be converted back to a date.

select Right("0" & Month([datefield]),2) & "/" & ...
(the rest is left as an exercise for the reader)

You are right, as usual, I stand corrected.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top