Admin Tools
AD timestamp converter
Turn the 18-digit values of lastLogon, lastLogonTimestamp, pwdLastSet and accountExpires, and the generalized time of whenCreated, into dates in UTC and your time zone — many at once — and turn a date back into a value for an LDAP filter.
Value to date
A FILETIME number such as 134393814000000000 — in decimal or with 0x — or a generalized time such as 20261117093000.0Z. A line may start with the attribute’s name, as ldp and PowerShell print it: accountExpires: 9223372036854775807.
Each line gets its result here as you type. The attribute decides what 0 and 9223372036854775807 mean.
Date to value
For an LDAP filter on a date: accounts that have not logged on since a day, or were created after one.
- FILETIME
—- Generalized time
—- No logon since then
—- Created since then
—- In UTC
- —
- Your time
- —
Accounts that never logged on have no lastLogonTimestamp and match no condition on it: the LDAP filter examples show the complete filter for inactive accounts.
What you type stays in your browser: nothing is sent anywhere.
Which attribute, which format
FILETIME is a 64-bit count of 100-nanosecond intervals since January 1, 1601, UTC: 18 digits for every date from 1918 to 4768. Generalized time is text, YYYYMMDDHHMMSS.0Z, where Z means no offset from GMT, in which Active Directory stores these times.
| Attribute | Format | What it records | Special values |
|---|---|---|---|
lastLogon | FILETIME | The last logon, as the domain controller you read it from saw it. Not replicated: each domain controller keeps its own, and the latest across all of them is the true last logon. | 0: unknown |
lastLogonTimestamp | FILETIME | The last logon to the domain, replicated to every domain controller but updated only when the stored value is older than msDS-LogonTimeSyncInterval (14 days by default) less a random part of up to 5 days. More below. | — |
pwdLastSet | FILETIME | When the password was last changed. | 0: the user must set a new password at the next logon, unless userAccountControl has DONT_EXPIRE_PASSWORD (0x10000) |
accountExpires | FILETIME | When the account expires. | 0 or 9223372036854775807 (0x7FFFFFFFFFFFFFFF): never expires. A new account gets 9223372036854775807; an account whose expiry date is removed gets 0. |
badPasswordTime | FILETIME | The last logon attempt with a wrong password. Not replicated: kept separately on each domain controller. | 0: unknown |
lockoutTime | FILETIME | When the account was locked out. Reset only by a successful logon, so it can still be set after the lockout has ended: add the domain’s lockout duration and compare with the current time. | 0: not locked out |
whenCreated | Generalized time | When the object was created. Replicated. | — |
whenChanged | Generalized time | When the object last changed. Not replicated: each domain controller keeps its own. | — |
Sources, Microsoft Learn: FILETIME · Last-Logon · Last-Logon-Timestamp · Pwd-Last-Set · Account-Expires · Bad-Password-Time · Lockout-Time · When-Created · When-Changed · String(Generalized-Time) syntax
Without this page
On Windows, w32tm /ntte 134393814000000000 converts a FILETIME, which Microsoft there calls a Windows NT system time. In PowerShell, [datetime]::FromFileTimeUtc(134393814000000000) returns the UTC date; it refuses 9223372036854775807, a time later than the latest date .NET can hold.
Sources, Microsoft Learn: Windows Time service tools and settings (w32tm /ntte) · DateTime.FromFileTimeUtc
lastLogon or lastLogonTimestamp?
Both record when an account last logged on, for different jobs. lastLogon is exact, but each domain controller keeps its own; lastLogonTimestamp is the same on every domain controller, and deliberately days behind.
| Property | lastLogon | lastLogonTimestamp |
|---|---|---|
| Replicated | No. Updated only on the domain controller that validates the logon. | Yes. Once replication has caught up, every domain controller holds the same value. |
| Updated | When that domain controller validates a logon. | At a logon, only when the stored value is older than msDS-LogonTimeSyncInterval less a random part of up to 5 days. |
| How current | Exact for that domain controller. The latest value across all domain controllers is the true last logon. | 9 to 14 days behind the current date with the default interval of 14 days. |
| Read it | From every domain controller in the domain, keeping the largest value. | From any one domain controller, in one query. |
| Built for | The exact last logon. | Finding inactive accounts. Microsoft: it is not meant to give real-time logon information. |
- The interval.
msDS-LogonTimeSyncIntervalis set on the domain, in days. Shown as “Not Set” in ADSI Edit, it is 14, the default. Below 5 days the random part is not applied, and 0 turns the updates off. The domain must be at the Windows Server 2003 functional level or higher forlastLogonTimestampto be updated at all. - Choosing a threshold. Because the timestamp can be 14 days behind, a threshold of 14 days or less cannot be trusted. Microsoft’s directory services team notes that most customers start treating accounts as possibly inactive at 30 days or more.
- Logon events. For near real-time logon tracking Microsoft points to the domain controllers’ security event logs — event 4624 on Windows Vista and Windows Server 2008 and later — not to either attribute.
- Two more kept per domain controller.
badPasswordTimeandwhenChangedare not replicated either.
Sources, Microsoft Learn: Last-Logon · Last-Logon-Timestamp · ms-DS-Logon-Time-Sync-Interval · Ask the Directory Services Team: “The LastLogonTimeStamp Attribute” – “What it was designed for and how it works” (2009, archived) · Bad-Password-Time · When-Changed
In AD Reports
The converter reads the values you paste. These reports list every account by the same values:
- Inactive Users for XX Days: Logon StatusUsers who never logged on or not for the days you choose, from lastLogon read on every domain controller.
- Inactive Users for XX Days: Logon TimestampThe same from the replicated lastLogonTimestamp: one query, up to 14 days behind.
- Inactive Computers for (Timestamp): ComputersComputer accounts that have not logged on for at least the days you choose, by lastLogonTimestamp.
- Must Change Password at Next Logon: Password StatusAccounts flagged to change their password at the next logon.
- Password Changed During Last XX Days: Password StatusRecent password changes, for the days you choose.
- Accounts Never Expire: Account StatusAccounts set to never expire.
- Accounts Expiring Within XX Days: Account StatusAccounts that expire within the days you choose.
- Locked User Accounts: Account StatusAccounts locked out after failed logon attempts.
- Accounts Created During Last XX Days: Account StatusRecently created accounts, for the days you choose.
- Reports with Non-Replicated Attributes: GuideAdd lastLogon, badPasswordTime or whenChanged to a report and each selected domain controller is scanned for it.
See it for every account
Download the free 14-day trial: who never logged on, who is inactive and who is active, for every user and computer in your domain.