472,127 Members | 1,437 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

Date filed in Access Database

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
Jul 3 '07 #1
3 2749
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.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 3 '07 #2
Evertjan. wrote:
>How to format the query to english date format (mm/dd/yyyy)?

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)
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 3 '07 #3
Bob Barrows [MVP] wrote on 03 jul 2007 in
microsoft.public.inetserver.asp.general:
Evertjan. wrote:
>>How to format the query to english date format (mm/dd/yyyy)?

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.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 3 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Luis Esteban Valencia | last post: by
6 posts views Thread by yoshitha | last post: by
3 posts views Thread by John | last post: by
3 posts views Thread by Finn Stampe Mikkelsen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.