Solved

Convert Date to Long? Like in VB6

Posted on 2004-10-07
6
1,060 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

820 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