1 Reply Latest reply on Oct 20, 2009 1:52 PM by jonnyt

    Filemkaer ESS calculation to convert Unix time to readable date

    jonnyt

      Title

      Filemkaer ESS calculation to convert Unix time to readable date

      Post

      Hi there,

       

      I have a table in a website that has a creationg date that uses the PHP Time() function to insert the current timestamp.

       

      I think its also known as a UNIX timestamp. Which is what what you get when you call time() in PHP.
      It's the amount of seconds since 01-01-1970 00:00:00.

       

      How can I convert this into a readable timestamp inside filemaker using a calculation?

        • 1. Re: Filemkaer ESS calculation to convert Unix time to readable date
          jonnyt
            

          Found this on another website:-

           

          1)create custom function with 2 parameters - UnixTime and time_zone_offset

           

          2) here is the custom function that returns the full timestamp including date and time

           

          Let (
          [
          UnixTimeAdjusted = (UnixTime + (time_zone_offset * 3600));
          days = Truncate(Div(UnixTimeAdjusted;86400);0);
          days_remainder = Mod(UnixTimeAdjusted;86400);
          hours = Truncate(Div (days_remainder; 3600);0);
          hours_remainder = Mod (days_remainder; 3600);
          minutes = Truncate(Div( hours_remainder; 60);0);
          minutes_remainder = Mod ( hours_remainder; 60);
          seconds = minutes_remainder
          ];
          Timestamp (Date ( 1; 1; 1970) + days; Time ( hours ; minutes ; seconds ))
          )