Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2004

    Unanswered: Date/Time Access

    I am trying to insert the correct date format into an access database using ASP (SQL)

    I have searched the topics on the forum but don't answer my question.


    I have set the Locale to Session.LCID = 2057 British Time/Date

    I have used the SQL Statement

    strSQL = strSQL & "'," & "#" & Now() & "#" & ")"

    But it inserts the Date/Time in American format still.

    How can I overcome this probelm?

    Thanks in advance Gaz

  2. #2
    Join Date
    Feb 2004
    Chicago, IL
    I know more about Access than I do about ASP. Are you looking at the date in an Access table after it has been inserted? If so, Access stores date information the same way, there are a couple of things that affect the way it displays. One is the Format function, another is the Regional Settings of the OS (assuming it is Microsoft). You will probably need to use the Format function to get it to display the way you want. Ex.


  3. #3
    Join Date
    Aug 2004
    That code did not work in ASP,

    I tried a few work arounds but it still didn't work.

    I managed to get around the problem as so,

    strDate = Now()

    strDate = Replace(strDate, " PM", "")
    strDate = Replace(strDate, " AM", "")

    The reason why it was not inserting the record was because Now() has PM or AM at the end the date.

    I am having a strange problem now though,
    the date is inserted into the record using

    Session.LCID = 2057

    British format,

    And appears in the database in this format.

    When I display the record the date appears in american format with PM/AM?

    I inserted a record directly into the database and the format is correct?
    But when viewing it, it does not show the PM/AM as the records that I inserted with the ASP/SQL does.

    Swings and Roundabouts!

  4. #4
    Join Date
    Nov 2003
    Christchurch, New Zealand
    The key problem is that you are dealing with three different user profiles when you are doing this stuff...

    One is the profile of the SQL user, it has it's own data time format setting...

    Another is the profile for the IUSR account...

    The last is the profile for the default user.

    I wish I had a really good answer that would solve all your problems but I honestly haven't been able to find one.

    What I tend to do is rebuild my dates into whatever format I want using month, day and year functions....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts