Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Date filed in Access Database

Reply
Thread Tools

Date filed in Access Database

 
 
Savvas Tsitouridis
Guest
Posts: n/a
 
      07-03-2007
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


 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      07-03-2007
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)
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      07-03-2007
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"


 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      07-03-2007
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)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Creating a Dynamic Date Filed Sue Roussie HTML 1 07-13-2004 05:42 PM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
How to Validate a Date Filed. RSB ASP .Net 6 05-21-2004 09:06 PM



Advertisments