MichMat
asked on
Convert a string to Excel serial date number
Hi,
In VB.net how do I convert a string "dd/mm/yyyy" into excel serial number as a string?
The date is going back into a CSV file so the output will be text anyway.
Thank you
Michal
In VB.net how do I convert a string "dd/mm/yyyy" into excel serial number as a string?
The date is going back into a CSV file so the output will be text anyway.
Thank you
Michal
DateTime.ToString
Here is detailed article on that
http://articles.techrepublic.com.com/5100-3513-6106789.html
Hope it helps
Thanks
http://articles.techrepublic.com.com/5100-3513-6106789.html
Hope it helps
Thanks
ASKER
Thank you, however that only addresses the string, the conversion to Excel serial number isnt there
unless Im missing something.
Michal
unless Im missing something.
Michal
Convert it to date then to long and then to string.
--
JimFive
--
JimFive
Try this
DateTime.ToOADate - it returns double
Then convert double to string.
DateTime.ToOADate - it returns double
Then convert double to string.
ASKER
That still does not give me the EXCEL SERIAL DATE NUMBER or does it ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you
Dim Adate as DateTime
Dim a_date_string as string = "13/08/2008" (AU format)
ADate = CDate(a_date_string)
a_date_string = ADate.ToOADate.ToString 'Date
Dim Adate as DateTime
Dim a_date_string as string = "13/08/2008" (AU format)
ADate = CDate(a_date_string)
a_date_string = ADate.ToOADate.ToString 'Date