Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7882727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:21:11+00:00 2026-06-03T04:21:11+00:00

I have an intranet running on a linux box, which authenticates against Active Directory

  • 0

I have an intranet running on a linux box, which authenticates against Active Directory on a Windows box, using LDAP through PHP.

I can retrieve a user’s entry from AD using LDAP and access the last login date from the php array eg:

echo $adAccount['lastlogontimestamp'][0]; // returns something like 129802528752492619

If this was a Unix timestamp I would use the following PHP code to convert to a human readable date:

date("d-m-Y H:i:s", $lastlogontimestamp);

However, this does not work. Does anyone know how I can achieve this or indeed if it is possible to do so from a Linux box?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:21:12+00:00Added an answer on June 3, 2026 at 4:21 am

    According to this, the windows timestamp you have there is the number of 100-ns since Jan 1st 1601. Therefore, you could just convert it to a unix timestamp using the following formula:

    tUnix = tWindow/(10*1000*1000)-11644473600;
    

    You divide by 10*1000*1000 to convert to seconds since Jan 1st 1601 and then you discount 11644473600 which is the number of seconds between Jan 1601 and Jan 1970 (unix time).

    So in PHP:

    date("d-m-Y H:i:s", $lastlogontimestamp/10000000-11644473600);
    

    EDIT: Interestingly, I got a different offset than Baba. I got mine with Java:

    Calendar date1 = Calendar.getInstance(); date1.set(1601, 1, 1);
    Calendar date2 = Calendar.getInstance(); date2.set(1970, 1, 1);
    long dt = date2.getTimeInMillis() - date1.getTimeInMillis();
    System.out.println(String.format("%f", dt / 1000.0)); // prints "11644473600.000000"
    

    According to this SO: Ways to Convert Unix/Linux time to Windows time my offset is correct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Intranet http application running on several machines in our Windows domain;
I have a large .NET based system running within the company intranet, which allows
I have a intranet site running PHP 5 that needs to list a folder
We have an instance of IIS6 running an intranet website with Windows Authentication and
I have an ASP.NET application which will be running in a web server (Windows
I have intranet highly user interactive ASP.net applications, which now I am going to
I have an intranet on the Drupal platform. I am using permission to restrict
I have my intranet app with windows authentication. On my local machine I run
We have an in-house webapp running for internal use over the intranet for our
I have a web application set up on our intranet that uses windows authentication

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.