2 Replies Latest reply on Feb 9, 2010 3:34 AM by LaRetta_1

    Converting Dates From YYDDD where DDD is 365 day format

    bbqchick

      Title

      Converting Dates From YYDDD where DDD is 365 day format

      Post

      What is the easiest way to convert dates that are in YYDDD format in FileMaker. DDD is a number from 1 - 366. Thanks

        • 1. Re: Converting Dates From YYDDD where DDD is 365 day format
          philmodjunk
            

          Assuming all YY years refer to the year 2000 or greater...

           

          let ([ year = 2000 + Left ( YYDDDfield ; 2 ) ; days = right ( YYDDDfield ; 3 ) ] ; Date ( 1 ; 1 ; year ) + days - 1 )

          • 2. Re: Converting Dates From YYDDD where DDD is 365 day format
            LaRetta_1
              

            Are there leading zeros on the day; I assume yes because you used DDD but I just want to be sure (this can be confused by people).  If so, Phil's calc will work.  If not then the calc will break if the number of days is less than 3 because Right ( field ; 3 ) will then grab the year also as part of the three characters.  One could also include the days right within the date result so instead of:

             

            Date ( 1 ; 1 ; year ) + days - 1 it could be Date ( 1 ; days ; year )


            If you DO need to account for unpadded days, change the days variable to days = Right ( text; Length ( text ) - 2 )