• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1110
  • Last Modified:

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?
0
Level10Access
Asked:
Level10Access
  • 3
  • 2
1 Solution
 
Bob LearnedCommented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now