So dealing with Active Directory and timestamps, not fun. If you go into the Attribute Editor in AD and look at a timestamp on a use, accountExpires for example, it's a huge 64-bit integer. How does that represent a time? More importantly, how do you get Nintex to turn it into a DateTime variable?
AD timestamps (aka WinTime, aka FileTime) is the number of 100-nanosecond intervals since 01/01/1601 @ 00:00.
You can think of it as how many 0.0000001 seconds have past since 01/01/1601.
One think to watch out for is what happens when the user is set not to expire? This sets the accountExpires attribute to either "0" or "9223372036854775807" which is hex for 0x7FFFFFFFFFFFFFFF. Best not to think about why Microsoft chose that, I've lost a few brain-cells trying to figure it out.
Another hurdle to watch out for is that the earliest time that Nintex can deal with is 01/01/1900, so it can't go all the way back to the year 1601 to do the math. To get around that, we'll be applying an offset to bring it up to 01/01/1900.
Ok, so you've retrieved the timestamp from an AD query, but it's just a large number as a string. Below is an example workflow you can use to turn it into a DateTime variable.
Here is the Calculate Date function. Basically, take 01/01/1900 @ midnight and add on the timestamp in minutes.
And that's it!
That big, nasty timestamp is now in a nice, friendly DateTime variable that we can do things with and checks against. It'll also determine if an account is set to expire or not.
I interface with AD in most of my workflows so I turned this into a User Defined Action, making things nice and easy. I like nice and easy.
Attached is a copy of the workflow.
Thanks for the tips David
No problem, glad I could help
This document was generated from the following discussion: Reading AD timestamps / time values