VB : CDate Function

Posted by Fluffy | 6:38 AM | , , | 0 comments »

Using CDate Function in VB


CDate function is used to convert a data into date data type. The example below illustrate how you can convert a date from a textbox into a date data type.


Dim Output As Date '----Declare Variables


TextBox1.Text = "January 20, 2009" '---- Initialize date in the textbox.

Output = CDate(TextBox1.Text) ' Convert the string to Date data type.

MsgBox(Output) '----The output is 20-Jan-09


That's how date is converted in using CDate function in your VB programming code.

See Also CType Functions

0 comments