开发者

How to get convert into date value

开发者 https://www.devze.com 2022-12-19 14:01 出处:网络
How to convert text value into date开发者_开发问答 Textbox1 column value = 31/12/2009 (dd/MM/yyyy)

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


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消