Date filed in Access Database
Date filed in Access Database
am 03.07.2007 11:23:03 von 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
Re: Date filed in Access Database
am 03.07.2007 11:45:29 von exjxw.hannivoort
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)
Re: Date filed in Access Database
am 03.07.2007 13:06:15 von reb01501
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"
Re: Date filed in Access Database
am 03.07.2007 13:25:49 von exjxw.hannivoort
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)