Convert DateTimeOffset to Military time VB.NET

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22200627/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 16:59:00  来源:igfitidea点击:

Convert DateTimeOffset to Military time VB.NET

.netvb.netdatedatetimedatetimeoffset

提问by theB3RV

I am needing to convert a DateTimeOffset {2/5/2014 2:28:13 PM -06:00} to Military time of 02/05/2014 14:28:13 and without the PM or the -6:00.

I am needing to convert a DateTimeOffset {2/5/2014 2:28:13 PM -06:00} to Military time of 02/05/2014 14:28:13 and without the PM or the -6:00.

SOLVED: I currently have this: row.TimeStamp is DateTimeOffset {2/5/2014 2:28:13 PM -06:00}

SOLVED: I currently have this: row.TimeStamp is DateTimeOffset {2/5/2014 2:28:13 PM -06:00}

thisTime = row.TimeStamp.DateTime
currTime = Format(thisTime, "yyyy/M/dd HH:mm:ss")

回答by Carl Spackler

for row.TimeStamp = {2/5/2014 2:28:13 PM -06:00}

for row.TimeStamp = {2/5/2014 2:28:13 PM -06:00}

thisTime = row.TimeStamp.DateTime
currTime = Format(thisTime, "yyyy/M/dd HH:mm:ss")

currTimeis then {2014/02/05 14:28:13}

currTimeis then {2014/02/05 14:28:13}