Date filed in Access Database

Discussion in 'ASP General' started by Savvas Tsitouridis, Jul 3, 2007.

  1. 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
    Savvas Tsitouridis, Jul 3, 2007
    #1
    1. Advertising

  2. Savvas Tsitouridis

    Evertjan. Guest

    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)
    Evertjan., Jul 3, 2007
    #2
    1. Advertising

  3. 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"
    Bob Barrows [MVP], Jul 3, 2007
    #3
  4. Savvas Tsitouridis

    Evertjan. Guest

    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)
    Evertjan., Jul 3, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patricia Kline

    application filed to initialize properly

    Patricia Kline, Feb 26, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    511
    Patricia Kline
    Feb 26, 2004
  2. RSB

    How to Validate a Date Filed.

    RSB, May 20, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    512
    John Oakes
    May 21, 2004
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,231
    Michael Borgwardt
    May 30, 2004
  4. david wolf
    Replies:
    4
    Views:
    371
    Oliver Wong
    Apr 21, 2006
  5. Sue Roussie

    Creating a Dynamic Date Filed

    Sue Roussie, Jul 13, 2004, in forum: HTML
    Replies:
    1
    Views:
    421
    Jeff Thies
    Jul 13, 2004
Loading...

Share This Page