我在几分钟(例如538分钟)内从Web服务获得了返回值。我需要在数小时和数分钟内对此进行分解。用.net代码和VB6代码(两个应用程序使用该服务)将速度从几分钟转换为HH:mm的最快方法是什么?
谢谢
最佳答案
此代码在.NET和VB6中均应工作:
Dim hours As Integer = 538 \ 60
Dim minutes As Integer = 538 - (hours * 60)
Dim timeElapsed As String = CType(hours, String) & ":" & CType(minutes, String)
label1.Text = timeElapsed
仅在.NET中,您应该能够执行以下操作(需要进行测试):
Dim timeElapsed As DateTime = New DateTime(1, 1, 1, 0, 538, 0)
label1.Text = timeElapsed.ToString("HH:mm")
我希望这有帮助!
关于vb.net - 将总分钟转换为HH的最佳方法:mm format?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4135775/