Ask the Expert

Using C#, what is the best way to convert the last computer logon/logoff properties into a meaningfu

I am using C# to develop a program that will identify the last time a computer (not user) was logged onto the domain. My question here is two fold.

First of all, I need to know the best way to convert the last logon/logoff properties into a meaningful date/time format? How can I do this? I have read some pieces concerning how to do it in VB, but they never seemed to work in C#.

The second part of the question is: what do the last logon/logoff properties for Active Directory computers really tell you? More to the point, when is that property set? Is it set when the computer is turned on and cleanly shut down, or is there some other mystical point at which this occurs?
Interestingly, I'm hearing more and more about developers wanting to take advantage of Active Directory. The value returned by the last logon/logoff properties are the number of seconds since 00:00:00 January 1, 1970 UTC. Since the time is a large set of bits, you can look at the source code to the ctime function to see how to break it up.

This was first published in September 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: