7 Replies Latest reply on Sep 29, 2013 1:01 PM by danlee

    How to enter in dates with / slashes

    danlee

      Title

      How to enter in dates with / slashes

      Post

           Right now I have to put in the slashes for the dates.  Is there a way to just put the numbers in and that slashes appear or just have the slashes default in the field?

           Example:  

           Birthdate:    /  /    put in the numbers and appears as  7/26/1981

        • 1. Re: How to enter in dates with / slashes
          davidanders

               Birthdate - standard data field with Calendar dropdown

               BirthDay, BirthMonth, and BirthYear - separate fields
               BirthDate (calculation field) = BirthDay & "/" & BirthMonth & "/" & BirthYear

               BirthDateEnter (eight digits)
               BirthDate (calculation field) = Left two digits & "/" & Middle two digits & "/" & Left four digits

               Left Middle and Right are functions
                

                

                

          • 2. Re: How to enter in dates with / slashes
            davidanders

                 Oh, the date field stores a date as a number - number of days since 1/1/1900

                 So you could have a number field - DayNumber - enter the number of days since then

                 Birthdate is a Calculation field of Date Type = DayNumber

            • 3. Re: How to enter in dates with / slashes
              danlee

                   Thank you for your help.  But I am at a lost.  

                    

                   Birthdate - standard data field with Calendar dropdown  Not sure where this option is

                   BirthDay, BirthMonth, and BirthYear - separate fields  Is this the script to put in?
                   BirthDate (calculation field) = BirthDay & "/" & BirthMonth & "/" & BirthYear

                   BirthDateEnter (eight digits)
                   BirthDate (calculation field) = Left two digits & "/" & Middle two digits & "/" & Left four digits

                   Left Middle and Right are functions
                    

              • 4. Re: How to enter in dates with / slashes
                philmodjunk

                Not sure where this option is

                     It's an option you can select on the Inspector's data tab for a date field.

                Is this the script to put in?

                     This is a calculation that can be defined for a field. You enter three separate values in three separate fields and the calculation combines them in a date. But I'd use this expression myself:

                     Date ( BirthMonth ; BirthDay ; BirthYear )

                     And I would also use the date function with the third option. Getting this data stored as an actual date value gives you options for searches, sorts and calculations not possible with the date stored as text (unless you then convert the text into a date).

                     It is also possible to enter digits with no delimitters with a field of type date if you use a script performed by the OnObjectValidate script trigger to take the text thus entered and convert it into a date before FileMaker's built in validation kicks in and throws up an error message.

                • 5. Re: How to enter in dates with / slashes
                  danlee

                       So create 3 separate fields:  BirthMonth, BirthDay and BirthYear

                       Then another field, Date, with calculation, Date ( BirthMonth ; BirthDay ; BirthYear )

                  Then in the Layout have the field Date and I can just put in the birth dates and it should show up as 7/26/1972?

                  • 6. Re: How to enter in dates with / slashes
                    philmodjunk

                         You have been provided with a list of options and the separate fields is just one such option. You would put the three separate fields on the layout and would enter the data into those separate fields. The calculation field would then return the actual date.

                    • 7. Re: How to enter in dates with / slashes
                      danlee

                           Makes sense.  Got it!  Thank you guys!!!