VB.NET 如何将秒转化为小时 , 分钟,秒的形式Public Class Form1
Private Function ZToFSAll(ByVal ZT As Long) As String
'全存样式
'从天 , 时,分,秒整合为秒
Dim T,S,F,M As Integer '天 , 时,分,秒
Dim T1,S1 As Integer '天,时,分,秒
Dim M1 As String
T = ZT \ 86400
T1 = ZT Mod 86400
S = T1 \ 3600
S1 = T1 Mod 3600
F = S1 \ 60
M = S1 Mod 60
If M10 Then
M1 = "0"M
Else
M1 = M
End If
ZToFSAll = T"天"S"小时"F"分钟"M1"秒"
End Function
Private Function ZToFSQS(ByVal ZT As Long) As String
'缺损样式
'从秒分解为天,时 , 分,秒
Dim T,S,F,M As Integer '天,时 , 分,秒
Dim T1,S1 As Integer '天,时,分,秒
Dim T2 , S2 , F2,M2 As String'天,时,分 , 秒
【vb.net算分钟 vb计算时间间隔】T = ZT \ 86400
T1 = ZT Mod 86400
S = T1 \ 3600
S1 = T1 Mod 3600
F = S1 \ 60
M = S1 Mod 60
If T = 0 Then
T2 = ""
Else
T2 = T"天"
End If
If S = 0 Then
S2 = ""
Else
S2 = S"小时"
End If
If F = 0 Then
F2 = ""
Else
F2 = F"分钟"
End If
M2 = M"秒"
ZToFSQS = T2S2F2M2
End Function
Private Function FSoZT(ByVal T As Integer,ByVal S As Int16,ByVal F As Int16, ByVal M As Int16) As Long
'从天,时,分 , 秒分解为秒
'T , S,F,M分别为天,时,分 , 秒
FSoZT = T * 86400 + S * 3600 + F * 60 + M
End Function
Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = ZToFSQS(520354) '值为:6天32分钟34
TextBox1.Text = ZToFSAll(520354) '值为:6天0小时32分钟34秒
TextBox1.Text = FSoZT(6,0,32, 34) '值为:520354
End Sub 。
vb.net怎样把小时、分钟、秒转换为分钟这个简单 。dim time1 datetime ="1:20:30"dim h as int =time1.tostring("hh")dim M as int =time1.tostring("MM")dim S as int=time1.tostring("ss")dim SUMfen as double=h*60+M+S/60SUMfen就是最后 的结果 。语法你自己修改下 。纯手打 。
vb.net时间间隔的计算Public Class Form1
Private Past As Date
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Past = Now
IO.File.AppendAllText("test.txt", Past.ToString, System.Text.Encoding.Default)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Now1 As Date = CDate(IO.File.ReadAllText("test.txt", System.Text.Encoding.Default))
Dim Now2 As Date = Now
MsgBox("从"Now1.ToString"到"Now2.ToString"经过了"CStr(CDate((Now2 - Now1).ToString)))
End Sub
实际情况修改下 。
End Class
vb.net算分钟的介绍就聊到这里吧 , 感谢你花时间阅读本站内容,更多关于vb计算时间间隔、vb.net算分钟的信息别忘了在本站进行查找喔 。
推荐阅读
- 幼儿走廊体育游戏观察记录,幼儿园廊道体育游戏
- jsvoid函数,js void函数
- 手机报价网站制作,手机报价的网站
- 电脑系统声音没声怎么回事,电脑系统声音不响怎么办
- php中如何对数据排序 php 排序函数
- 视频号开通城市的简单介绍
- 华为畅享20pro鸿蒙新功能,畅享20se鸿蒙
- 宁夏固原代理招聘兼职平台,宁夏固原58同城招聘网
- java整数反转代码 java 整数反转