Solved

Convert Date to Long? Like in VB6

Posted on 2004-10-07
6
1,041 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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