How to set the system date format in Access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Matsam
    New Member
    • Jun 2007
    • 33

    How to set the system date format in Access

    Hello,

    I have an Access program with 4 forms. In the load event of the main form, I need to set the system date format to British. Can anyone please give the code for setting the system date format ?

    Thanks in advance

    Matsam
  • grahamib
    New Member
    • Nov 2009
    • 4

    #2
    Hi
    Maybe too simple but have you tried
    "=Now()"
    in the fields where you want the system date. As long as the p.c. you are on has the correct regional date this will return that date.

    Cheers

    Grahamib

    Comment

    • MMcCarthy
      Recognized Expert MVP
      • Aug 2006
      • 14387

      #3
      Access does have some problems where it reverts to the American Date format. Unfortunately, you can't overwrite this in one go. Wherever you need the date it is always best policy to enforce the British format. The following function will format the system date.

      Code:
      Format(Now(), "dd/mm/yyyy")
      For more information you can check out an article on using Dates in Access in our Insight forum.

      Literal DateTimes and Their Delimiters (#)

      Mary

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32661

        #4
        Your question illustrates a certain lack of understanding on your part (I assume).

        If I explain that the System Date format is a System level entity then maybe you will understand that it's not something generally amended from within a single application (It may be possible, but except for extreme circumstances it should never be done. It is essentially out of scope).

        Can you explain more clearly what you need it for and we can give some consideration to what may be most appropriate in you situation. Mary's suggestion may well be the solution, but a clearer understanding of your problem would be necessary to know.

        Generally, formatting of values should only ever be done as the last step in a process. While a formatted string may look similar to a value to the human observer, it is not treated as very similar within the code.

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          I took the question literally, as NeoPa apparently did, where as the OP wants to actually change the format used by Windows in displaying the date at the System level, and as he said, you simply do not do this from any app!

          Users expect System settings to either be the default settings or those they chose themselves. While a developer may have a reason for wanting the date format to be British, as he/she does here, the end user may be multi-tasking, running other programs that use dates, and may not be very understanding when they date format changes on all programs

          As Mary mentioned, in passing, Access not only prefers but at times insists that dates be in the American format in order for things to work correctly. Allen Browne has an excellent short paper on using international date formats in Access that is probably worth a read by anyone dealing with this issue:

          How to ensure dates are interpreted correctly in a Microsoft Access database, even when the user's regional settings are different from the US format.


          Linq ;0)>

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32661

            #6
            Indeed. As you say Linq, the SQL date format is the same as the American format, so using the American format will work the world over.

            Comment

            Working...