title: How to convert a datetime to accountExpires AD Attribute?
body: <p>I am using a <code>DirectorySearcher</code> filter that does not work, most probably because of a wrong form of <code>accountExpires</code> attribute from Active Directory. I would like to find all expired accounts using LDAP, but how can I convert <code>DateTime.Now</code> to <code>accountExpires</code> format? I have found lots on converting <code>accountExpires</code> to <code>Datetime</code> format but not the other way around. For example, I have found an example that says : </p>
  
  <pre><code>129383640000000000 is equivalent to Sat, 01 Jan 2011 14:00:00 GMT
  </code></pre>
  
  <p>How can I do it the other way? I know it is the interval of 100 nanoseconds from 1 JAn 1601 , but don't know how to calculate this   </p>