Not yet rated

Problem

ColdFusion doesn't natively support 64bit Active Directory timestamps

Solution

Using a combination of DateConvert and DateAdd you can transform an AD timestamp into a regular datetime object that ColdFusion can use.

Detailed explanation

Time in Active Directory is stored in a 64 bit integer that keeps track of the number of 100-Nanosecond intervals which have passed since January 1, 1601 (not to be confused with EPOCH, or with Active Directory's Generalized Time String). The 64 bit value uses 2 32bit parts to store the time.


This number, e.g 127944393687163952 can be converted to a local timestamp such as:

adTime = "127944393687163952";
cfTime = DateConvert("utc2Local",DateAdd('n',adTime /
(60*10000000),'1/1/1601') );

+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes