Den*_*ark 1 vb.net datetime visual-studio
这是我在excel中的日期时间数据
3/10/2014 11:59:59 AM
Run Code Online (Sandbox Code Playgroud)
我想在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
Run Code Online (Sandbox Code Playgroud)
我也想删除那个AM/PM
你可以像这样使用
Dim res As string=DateTime.Now.Tostring("yyyy-MM-dd hh:mm:ss")
Run Code Online (Sandbox Code Playgroud)
编辑:
Dim res As string=Convert.ToDateTime("3/10/2014 11:59:59 AM").Tostring("yyyy-MM-dd hh:mm:ss")
Run Code Online (Sandbox Code Playgroud)
我希望这有帮助.
| 归档时间: |
|
| 查看次数: |
14217 次 |
| 最近记录: |