tags:

views:

33

answers:

2

How to convert text value into date

Textbox1 column value = 31/12/2009 (dd/MM/yyyy)

Tried

Cdate(textbox1.text)

The above code is not working.

I want to get a date like this '31 Dec 2009'

How to write a code for getting this format.

Need vb.net code help

+4  A: 

You can try

DateTime.TryParseExact

Converts the specified string representation of a date and time to its DateTime equivalent using the specified array of formats, culture-specific format information, and style. The format of the string representation must match at least one of the specified formats exactly. The method returns a value that indicates whether the conversion succeeded.

This will allow you to parse the string into a DateTime. You can then use ToString to format the date as you wish.

Have a look at DateTime.ToString() Patterns

astander
A: 

Help / Search in the IDE and then search for "datetime string format".

dbasnett