Solved

Convert Date to Long? Like in VB6

Posted on 2004-10-07
6
1,029 Views
Last Modified: 2012-08-14
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
Comment
Question by:Level10Access
  • 3
  • 2
6 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 35 total points
ID: 12251811
Dim intDateSerial As Integer = DateTime.Parse("10/7/2004").ToADate

Bob
0
 
LVL 8

Expert Comment

by:bramsquad
ID: 12252060
i think what Bob means is...

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

~b
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12252071
No, I meant Integer.  In VB6, Long = 32-bit, and in VB.NET Integer = 32.

Bob
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 3

Author Comment

by:Level10Access
ID: 12252086
You meant ToOADate not ToADate. Figured that out. Thanks alot man. You've got the points!
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12252104
Yeah, ToOADate.  Typing in the comment block, without auto-complete :)

Bob
0
 
LVL 8

Expert Comment

by:bramsquad
ID: 12252152
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now