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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
vs1784Connect With a Mentor Commented:
Yes Converting ToOADate and then to string. It gives me Excel Serial Date Number.

0
 
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
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

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

Michal
0
 
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
 
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
All Courses

From novice to tech pro — start learning today.