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
MichMatAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vs1784Commented:
DateTime.ToString
0
vs1784Commented:
Here is detailed article on that

http://articles.techrepublic.com.com/5100-3513-6106789.html

Hope it helps

Thanks
0
MichMatAuthor Commented:
Thank you, however that only addresses the string, the conversion to Excel serial number isnt there
unless Im missing something.

Michal
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

JimFiveCommented:
Convert it to date then to long and then to string.
--
JimFive
0
vs1784Commented:
Try this

DateTime.ToOADate  - it returns double

Then convert double to string.
0
MichMatAuthor Commented:
That still does not give me the EXCEL SERIAL DATE NUMBER or does it ?
0
vs1784Commented:
Yes Converting ToOADate and then to string. It gives me Excel Serial Date Number.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MichMatAuthor Commented:
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.