Directory Services

DateTime Property

In ADSI, this property type is called ADSTYPE_UTC_TIME. To read the value from a date/time property, such as whenCreated, use the managed code DateTime structure to retrieve the property value.

Note  In the Active Directory Schema, the syntax for date and time is called String(Generalized-Time) and String(UTC-Time) which are both represented in the Syntax row of attribute tables with the Syntax ID of 2.5.5.11.

The following code example shows how to write a DateTime property on an object.

[C#]
DateTime newdt = new DateTime(2002, 10, 21, 11, 4, 5, 0);
de.Properties["TestTime"].Value = newdt;
de.CommitChanges();