1 Reply Latest reply on Jul 24, 2012 1:13 PM by philmodjunk

    Date Calculation



      Date Calculation


      We import data with date of birth listed as year-month-date.  Is there a calculation you can use to change to month-date-year?

        • 1. Re: Date Calculation

          IF you convert the date of birth (DOB) to data of type date, you can display it in any date format you want.

          If your data looks like this:


          Then this calculation can extract the year, month and day values so that it can be converted and stored as a date:

          Let ( [ D = YourdateasTextField ;
                    Y = Left ( D ; 4 ) ;
                    M = Middle ( D ; 6 ; 2 ) ;
                    Dy = Right ( D ; 2 )
                  Date ( M ; Dy ; Y )

          If this is not the format, (maybe years are two digits or single digit day and month numbers don't have leading zeroes), this same basic approach still works, but the details of the calcualtion would need to be changed.

          To use this calcualtion, you can import your DOB's into a text field and then a field of type Date can use the above calculation set up as an auto-entered calculation to take the text in the text field and convert it into a date stored in this date field. If you use this method, you must enable auto-enter options during import.

          You an also use this calculation with the Replace Field Contents tool in the Records menu to convert and copy the data from the text to the date field immediately after importing.