Asp Now Function Date Format

Discussion in 'General troubleshooting' started by Adagio, Jul 23, 2013.

  1. I am recording the date/time of events in an Access database using the Now function in classic Asp. The returned format is inconsistent sometimes dd/mm/yyyy other times mm/dd/yyyy. Is there any way of predetermining the format?
     
  2. Disappointed to get no response. The site is intended for UK users. If the date is 18th October then it is stored as 18/10/2013 if date 8th October then stored as 10/08/2013.
    I have set locale:-
    <% session.LCID=2057 %>
    but this does not seem to help is there any way I can resolve this apart from moving to a UK host?
     
  3. Elshadriel

    Elshadriel Winhost Staff

  4. Thanks for the reply I will study the links and see if I can find any clue. I believe that you may be wrong about the move to UK. The site was hosted in UK for several years until the company ceased trading earlier this year with no issues regarding date format. I assume because the server locale was set to UK.
     
  5. Elshadriel

    Elshadriel Winhost Staff

    Ah, that might be true, but the code is acting weird (inconsistent). If it was just pulling from the server, then it should at least be consistent (i.e. U.S. server should be Month-Day-Year format while U.K. server should be Day-Month-Year). Have you checked to see if your code is performing any modifications to the date value?
     
  6. Inconsistent - not sure of meaning in this context! Repeatable certainly. If day cannot be sensibly displayed in mm/dd/yyyy format e.g. 23rd October 2013 then it is 'correctly' displayed as 23/10/2013.
     
  7. Elshadriel

    Elshadriel Winhost Staff

    Sorry. Maybe I misunderstood the problem, but this line confused me:

    If the date is October 18, 2013, then it should be stored as 10/18/2013 on servers set to a U.S. time zone or region, and 18/10/2013 on servers set to a U.K. time zone or region.
     

Share This Page