这是我在 Excel 中的日期时间数据
3/10/2014 11:59:59 AM
我想在 vb.net 中将它转换成这样
// I have a variable that contains the datetime like this
Dim audit_date as DateTime = 3/10/2014 11:59:59 AM // and i want to convert this to the one below
Output = 2014-03-10 11:59:59
我也想删除 AM/PM
最佳答案
你可以这样使用
Dim res As string=DateTime.Now.Tostring("yyyy-MM-dd hh:mm:ss")
编辑:
Dim res As string=Convert.ToDateTime("3/10/2014 11:59:59 AM").Tostring("yyyy-MM-dd hh:mm:ss")
我希望这会有所帮助。
关于vb.net - 在 Vb.net 中转换日期时间格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22397856/