Date Format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deejow
    New Member
    • Jul 2007
    • 15

    Date Format

    Hi all,

    How do you make the date format comply with dd/mm/yy?

    When I test dates entered it changes 13/07/1968 to 07/13/1968 (to place month first) but if you type 02/03/1968 where 03 is the month it assumes 02 is the month and does not switch them causing errors.

    Also I want the year to be 2 digits (07 representing 2007) but sometimes if I enter a date as 13/02/07 it assumes the year to be 2013 returning 02/07/2013. Why can't the dates do what I want them to do?

    I have spent hours on this and am totally bummed out.

    deejow
  • damonreid
    Recognized Expert New Member
    • Jul 2007
    • 114

    #2
    Is it possible to use the dd/mmm/yy format thus getting around this problem?

    Another solution is to add a calendar control to the onclick for each date field; this will bring up a calendar and allow them to select a date from that?

    Comment

    • MikeTheBike
      Recognized Expert Contributor
      • Jun 2007
      • 640

      #3
      Hi

      This is a perennial problem when you local computer date setting is UK ?? ie dd/mm/yy as opposed to Microsofts (US) default of mm/dd/yy.

      The solution will depend on where you entering the date and how are you are using them from there?

      MTB

      Comment

      • Twanne
        New Member
        • Jul 2007
        • 65

        #4
        I've been searching for the solution of this problem for a very long time. Now I made a "stupid" function that switches the dates day and month if the day is smaller than 12.

        [CODE=vb]Public Function dateFormat(datu m) As String
        Dim test As Integer
        days = Format(datum, "dd")
        months = Format(datum, "mm")
        years = Format(datum, "yyyy")
        If (day < 13) Then
        test = days
        days = months
        months = test
        End If
        dateFormat = days & "/" & months & "/" & years
        End Function[/CODE]
        The when you have the string you can put it bacj in date format with CDate() or somthing

        Comment

        • MikeTheBike
          Recognized Expert Contributor
          • Jun 2007
          • 640

          #5
          Originally posted by MikeTheBike
          This is a perennial problem when you local computer date setting is UK ?? ie dd/mm/yy as opposed to Microsofts (US) default of mm/dd/yy.

          The solution will depend on where you entering the date and how are you are using them from there?
          I still think we need to know the aswers to these two questions !

          MTB

          Comment

          • Twanne
            New Member
            • Jul 2007
            • 65

            #6
            I understand what you mean but I have searched for a few days (maybe weeks) and I couldn't find it. So I've solved it this way

            Comment

            • deejow
              New Member
              • Jul 2007
              • 15

              #7
              Originally posted by damonreid
              Is it possible to use the dd/mmm/yy format thus getting around this problem?

              Another solution is to add a calendar control to the onclick for each date field; this will bring up a calendar and allow them to select a date from that?
              Mmmmm. I like the sound of the calendar control. How do I create such a blessed thing?

              deej

              Comment

              • puppydogbuddy
                Recognized Expert Top Contributor
                • May 2007
                • 1923

                #8
                Originally posted by deejow
                Mmmmm. I like the sound of the calendar control. How do I create such a blessed thing?

                deej
                Here is a link to a ready made calendar using an Access form, which has several advantages over an ActiveX. Step by step instructions are provided in the link.

                Free popup calendar (month view) for selecting a date in a Microsoft Access database. The calendar is an Access form, so requires no additional VBA references.

                Comment

                • deejow
                  New Member
                  • Jul 2007
                  • 15

                  #9
                  Originally posted by MikeTheBike
                  Hi

                  This is a perennial problem when you local computer date setting is UK ?? ie dd/mm/yy as opposed to Microsofts (US) default of mm/dd/yy.

                  The solution will depend on where you entering the date and how are you are using them from there?

                  MTB
                  Yes,

                  It is simple when you know where to look. The problem was fixed by going to: Control Panel > Regional and Language Options > (tab) Regional Options - select your region correctly then > (button) Customise > (tab) Date - change options to suit your needs.

                  An input mask of 99/99/99 was also used where '9' indicates a number from zero to 10 is required.

                  Thnx to all for helping.

                  Comment

                  • deejow
                    New Member
                    • Jul 2007
                    • 15

                    #10
                    Originally posted by puppydogbuddy
                    Here is a link to a ready made calendar using an Access form, which has several advantages over an ActiveX. Step by step instructions are provided in the link.

                    http://allenbrowne.com/ser-51.html
                    That is one of the coolest things I have ever seen...erm...I need to get out more.

                    Thnx dude

                    Comment

                    Working...