-
Nov 11th, 2014, 02:08 PM
#1
Thread Starter
New Member
How to convert a Date in to an integer?
How do i convert a Date into an Integer?
From this format: 12/03/2014
To this format: 41710
is there a function i can use?
and how would i get it back to this format: 12/03/2014
from this format: 41710
Thank you
-
Nov 11th, 2014, 02:13 PM
#2
Re: How to convert a Date in to an integer?
There is no link between 12/03/2014 to 41710 -__-
If you mean from 12/03/2014 to 120314 or 120032014 Then Convert it into a string and replace \ with nothing and convert that to an Integer.
-
Nov 11th, 2014, 02:23 PM
#3
Thread Starter
New Member
Re: How to convert a Date in to an integer?
-
Nov 11th, 2014, 02:49 PM
#4
Re: How to convert a Date in to an integer?
I believe there are two functions that might do what you are looking for. Take a look at this link:
http://msdn.microsoft.com/en-us/libr...v=vs.110).aspx
My usual boring signature: Nothing
-
Nov 11th, 2014, 02:58 PM
#5
Re: How to convert a Date in to an integer?
Have you tried, FromOADate and ToOADate ?
Code:
' convert Integer to Date
Debug.WriteLine(DateTime.FromOADate(41710)) ' 3/12/2014 12:00:00 AM
' convert a Date into an Integer
Dim myDate = New Date(2014, 3, 12)
Debug.WriteLine(myDate.ToOADate) ' 41710
-
Nov 11th, 2014, 03:00 PM
#6
Re: How to convert a Date in to an integer?
there really isn't a "formula" ... that IS the date. it's in a different format is all. The number behind the date is calculates as the number of _______ since _________. And it varies from system to system. I think it's determined by the number of minutes since 1/1/1900... for Linux systems it's since some date in 1963.
for the case given the date in the link, it's the number of days since 1/1/1900...
-tg
-
Nov 11th, 2014, 03:06 PM
#7
Re: How to convert a Date in to an integer?
Actually, I got a different number from what Excel reported (41579) ... hmm... that's off by quite a bit some 290 days...
Ahh.... 41579 days would be Nov 3, 2013 ... so there's potential date formatting issues to be resolved.
-tg
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
|