2 Replies Latest reply on Jul 30, 2015 12:35 AM by dgurusamy

    Convert to Date from number

    dgurusamy

      I'm retrieving records form the MySql database to my FileMaker. Its working fine.

       

      but the date field is not showing proper date format in FileMaker, which means Its shows numbers only (1438176871) Instead of the date (28/07/2015)

       

      I think I need a function to covert this number to date - I have tried with FileMaker predefined functions - But no use up to my knowledge.

       

      Can someone please help to fix this issue and get the date format from this number ? anybody has faced this issue before.

       

      Many Thanks

        • 1. Re: Convert to Date from number
          erolst

          What you have seems to be a UNIX timestamp, which denotes the number of seconds since midnight of 1st January, 1970.

           

          You could convert that to a FileMaker Date by using

           

          Let ( [

            UNIXTimestamp = 1438176871 ; // yourValue

           

            numberOfSecondsInADay = 86400 ;

            days = Div ( UNIXTimestamp ; numberOfSecondsInADay ) ;

            offset = 719162 // GetAsNumber ( Date ( 12 ; 31; 1969 ) )

            ] ;

            GetAsDate ( offset + days )

          )

           

          or, using all those values implicitly:

           

          GetAsDate ( 719162 + Div ( UNIXTimestamp ; 86400 ) )

          • 2. Re: Convert to Date from number
            dgurusamy

            Its works.. Thanks Erolst!