Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert.ToDateTime Method (Int64)
Message
 
To
17/07/2003 02:11:59
Keith Payne
Technical Marketing Solutions
Florida, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00810877
Message ID:
00811141
Views:
20
>>Scanning the .NET help files, help for the Convert.ToDateTime Method (Int64) returns the following information:
>>
>>"This conversion is not supported..."
>>
>>What's up with this?
>>
>>Specifically, I am writing a VB.NET routine that is querying Active Directory. First of all, I can't understand why the following AD fields are of data type Long:
>>    badpasswordTime
>>    pwdlastset
>>    usncreated
>>    accountexpires
>>    lastlogoff
>>    usnchanged
>>
>>...while the following fields are of data type Date:
>>    whencreated
>>    whenchanged
>>
>>They should all be date-time values shouldn't they?
>>
>>It wouldn't be a problem if the routine mentioned in the subject of this email were available, but it's not. How would one go about converting one of these 64-bit signed integer values to its equivalent DateTime format value (using VB.NET)?
>>
>>Thanks in advance!
>
>Kile,
>
>This might get you started: http://www.dotnet247.com/247reference/msgs/19/96138.aspx

Thanks Keith,

I actually found this article right after I posted my first message. But I've struggled to make it work for me. The example is in C#, and though I've been pretty successfull porting other C# snippets to VB, I had no luck with with this one.

The thing I'm stuck on is the LargeInteger cast. It's not available to me. I've tried to add the activeds.dll as a reference to my project, thinking it would provide the library I'm looking for. It wouldn't even let me add it as a reference.

I currently have the System.DirectoryServices as a reference, but it's not providing the LargeInteger cast either.

Perhaps I need to create my own LargeInteger class:

Public Class LargeInteger
   Dim mHighPart As Long
   Dim mLowPart As Long

   Public Property HighPart()
     Get
       Return mHighPart
     End Get
     Set(ByVal Value)
       mHighPart = Value
     End Set
   End Property

   Public Property LowPart()
     Get
       Return mLowPart
     End Get
     Set(ByVal Value)
       mLowPart = Value
     End Set
   End Property
...
End Class

But then, I'd have to be able to pull the high and low parts out of the original value to populate my class, and that's what I'm having trouble with in the first place - so this is putting the cart before the horse, so to speak.

I'm still struggling to understand why Microsoft would have provided dates in this Long Integer format, when at the same time, they already provide other datetime fields in the date format...?!? Seems to me like they had two different teams working on the Active Directory properties and one of them thought they'd be funny... *sigh*
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform