Quantcast
Channel: Forum Microsoft Identity Manager
Viewing all articles
Browse latest Browse all 6944

Active Directory, Format of date/time properties in C#

$
0
0

Hello Mate,

I am trying to make a decision at AD Management Agent Sync based on the value of Whencreated attribute in AD on daily basis.

When I import the value whencreated in AD connector space, the value is 20141209193924.0Z

I was believing it follow the format

YYYY -> four digit year
MM -> 2 digit month
DD -> 2 digit day

The code                   

if (csentry["Whencreated"].IsPresent)

                       {
                          DateTime currentDateTime = DateTime.Now;
                          String dateStr = currentDateTime.ToString("yyyyMMdd");
                           if (csentry["Whencreated"].Value.Remove(8).Equals(dateStr))

                           {

                             // Do Something.

                           }

                       }

However if I look whencreated attribute for the user in AD it is 12/10/2014 1:09:24 AM and see there is a difference of 1 day.
Kindly help how to convert the value of the format 20141209193924.0Z to date and time in C#

Thanks and Regards,
Anirban Singha

 


Viewing all articles
Browse latest Browse all 6944

Trending Articles