Convert Date to Long? Like in VB6

Hey guys,

I have some code in vb6:
        date = CLng(cdate("10/7/2004")
And it returns 38284
That is what i want to do in .net


If i try this in VB.Net, it says I cannot convert date to long. WHAT DO I DO?
LVL 3
Level10AccessAsked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
Dim intDateSerial As Integer = DateTime.Parse("10/7/2004").ToADate

Bob
0
 
bramsquadCommented:
i think what Bob means is...

Dim intDateSerial As Long = DateTime.Parse("10/7/2004").ToOADate

~b
0
 
Bob LearnedCommented:
No, I meant Integer.  In VB6, Long = 32-bit, and in VB.NET Integer = 32.

Bob
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
Level10AccessAuthor Commented:
You meant ToOADate not ToADate. Figured that out. Thanks alot man. You've got the points!
0
 
Bob LearnedCommented:
Yeah, ToOADate.  Typing in the comment block, without auto-complete :)

Bob
0
 
bramsquadCommented:
yea...i meant the ToOADate thing...

go ahead and give these pts to bob if you werent going to before...i really didnt do a whole lot here

~b
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.