|
-
Jun 8th, 2003, 04:05 AM
#1
Thread Starter
Lively Member
How to change a date to a double
Does anyone know how to change a date into a double?
I've used the DateTime.ToOADate and i can get the NOW and TODAY dates to convert to a double but i can't work out how to get a specific date,
EG:
1/6/2003 (thats 1st June, for those that use the US notion not 6th Jan)
Can anyone help?
-
Jun 8th, 2003, 06:23 AM
#2
Junior Member
I See...
Try to use this:
Code:
Dim d As Double
Dim x As Integer
x = InputBox("Enter", "Title", 12)
d = CDbl(x)
Last edited by Excelsoft; Jun 8th, 2003 at 06:27 AM.
Excelsoft IT
-
Jun 8th, 2003, 09:07 AM
#3
Thread Starter
Lively Member
hmmmm........, That looks like VB6 to me and wont work in .NET
After mucking around with it, changing the Integer to a Date.
It errors out with a "Converstion from Date to Double requires calling the Date.ToOADate method" which was what it was doing before. Like i said in the above post NOW and TODAY work ok but not a specific date.
-
Jun 8th, 2003, 09:57 AM
#4
I wonder how many charact
VB Code:
Dim c As Date
c = Convert.ToDateTime("01/06/03")
Dim r As Integer
MsgBox(c.ToString)
r = c.ToOADate
MsgBox(r.ToString)
-
Jun 8th, 2003, 07:10 PM
#5
Thread Starter
Lively Member
That looks like it'll work nemaroller, i'll test it out and see.
Thanks
-
Jun 8th, 2003, 07:18 PM
#6
Thread Starter
Lively Member
Yup! Worked, excellent.
Thank you very much nemaroller
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|