1 Reply Latest reply on Dec 9, 2019 2:11 PM by Danny Kellett

    Converting inetorgperson lastLogonTimestamp to human readable format

    Steven Pataray
      Share This:

      I created an inetorgperson Vendor form to access my ldap Active Directory data. I have a separate display form and would like to pull the lastLogonTimestamp date (and others) to a character field or date field so it can be displayed correctly. I know the date on Active Directory is an 18 character epoch date format. Is there a way to use a set field to convert this date to a human readable format?

        • 1. Re: Converting inetorgperson lastLogonTimestamp to human readable format
          Danny Kellett

          Hi Steven


          The value is not a epoch. It's a microsoft large integer and is 100 nanosecond steps since 12:00 AM January 1 1601. And it has some funny attributes about it too like it's only if the value is older than 14 days, minus a random percentage of 5 days. This restriction was designed to avoid network bandwidth usage by AD replication apparently... Lastly I am not sure where you are in the world but the value is stored in UTC so if you are anywhere else, you will have to add/remove time based on that shift.


          I took one from our AD here:


          This value increases every 100 nanoseconds and we want just nanoseconds

          131993731696950814 * 100 = 13199373169695081400


          Now we have the value 13199373169695081400 nanoseconds since 01/01/1601

          EPOC and the BMC AR System uses seconds since 01/01/1970. So first lets get that nanosecond number to seconds:

          13199373169695081400 x 0.000000001 = 13199373169.6950814 round to 13199373170

          13199373170 is the amount of seconds since 01/01/1601 and we want EPOC which is 01/01/1970 so we minus the amount of seconds difference between the two which I calculated using https://www.timeanddate.com/date/durationresult.html?d1=1&m1=1&y1=1601&d2=01&m2=01&y2=1970 as 11643609600


          13199373170 - 11643609600 = 1555763570


          This is the EPOC time in UTC 1555763570

          Saturday, April 20, 2019 12:32:50 PM



          AD num 131993731696950814

          Multiplied by 0.0000001

          Minus seconds diff between dated 11643609600

          Set fields with the above decimal field to a Date/Time field



          Good luck





          4 of 4 people found this helpful