在vb.net中将字符串转换为日期的问题 [英] Problem converting a string into date in vb.net

查看:82
本文介绍了在vb.net中将字符串转换为日期的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在vb.net中将字符串值转换为日期时遇到问题

例如

str =" 31.12。 2005年

i希望将其转换为日期格式,例如mm / dd / yyyy

i使用CDATE函数,但每次出现错误时字符串不能转换成日期


但是当我使用任何其他值如12.31.2005它工作正常


怎么能我将第一个str值更改为第二个值因为从我访问的地方总是有值31.12.2006



请给我一些想法

解决方案




我在vb.net中将字符串值转换为日期时遇到问题

例如

str =" 31.12.2005"



你可以使用ToString转换(MM / dd / yyyy)

展开 | 选择 | Wrap | 行号



感谢您的回复

i使用了这样的代码

展开 | 选择 | Wrap | 行号


好的使用像

展开 | 选择 | Wrap | 行号


Hi
I have a probleum in vconverting a string value into date in vb.net
e.g
str="31.12.2005"
i want to convert it into date format like "mm/dd/yyyy"
i use CDATE function for it but every time error comes " String can''t be converted into date"

but when i use any other value like 12.31.2005 it works fine

how can i change the first str value into 2nd value because from where i am accessing the always have the value "31.12.2006"


please give me some idea

解决方案

Hi
I have a probleum in vconverting a string value into date in vb.net
e.g
str="31.12.2005"

You can conver using ToString("MM/dd/yyyy")

Expand|Select|Wrap|Line Numbers


Hi
thanks for reply
i used your code like this

Expand|Select|Wrap|Line Numbers


Okay Use like

Expand|Select|Wrap|Line Numbers


这篇关于在vb.net中将字符串转换为日期的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆