日期格式vb.net问题 [英] DATE FORMAT vb.net issue

查看:107
本文介绍了日期格式vb.net问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我有一个问题即时通讯使用此代码来获取日期

hi everyone i have a question im using this code to get date

CDate(IIf(IsDate(dr("ApplicationDate").ToString), dr("ApplicationDate").ToString, "06/17/2013")) 



但我正在使用这个方案导入.csv文件然后它将保存在我的数据库中,在此文件中没有插入日期..但它已经导入日期06/17/2013仍在我的网站中查看我的问题是whta代码,适合我试图更新的代码上传时更新我的​​日期06/17/2013将替换为新的日期,我已经更新并在我的数据库中插入这样的




yet im using this with a scenario i import .csv file then it will save also in my db which in this file there is no date inserted.. but it is already imported the date 06/17/2013 still viewed in my site im making my question is whta code that suits the code that im trying to update when uploading to update my date that 06/17/2013 will replace with a new date wherein i already update and insert in my database like this

insert (applicationdate) values (getdate())





提前感谢



thanks in advance

推荐答案

如果我理解你的问题,你需要使用 DateTime.Now [ ^ ]代替06/17/2013。



所以,代码将是:



If I understood your question you need to use DateTime.Now[^] in place of "06/17/2013".

So, the code will be:

CDate(IIf(IsDate(dr("ApplicationDate").ToString), dr("ApplicationDate").ToString, DateTime.Now.ToString)) 

这篇关于日期格式vb.net问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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