真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

秒轉(zhuǎn)換成天vb.net,秒轉(zhuǎn)換成小時(shí)

用VB實(shí)現(xiàn):輸入以秒為單位表示的時(shí)間,編寫程序,將其換算成幾日幾時(shí)幾分幾秒

Option Explicit

成都創(chuàng)新互聯(lián)公司主營奉化網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,成都app軟件開發(fā),奉化h5重慶小程序開發(fā)搭建,奉化網(wǎng)站營銷推廣歡迎奉化等地區(qū)企業(yè)咨詢

Dim Times As String, T As Long

Dim D As Integer, H As Integer, M As Integer, S As Integer

Private Sub Form_Load()

Form1.AutoRedraw = True

Times = InputBox("輸入時(shí)間(單位:秒)", "輸入", 123456)

T = Val(Times)

S = T Mod 60

T = T \ 60

M = T Mod 60

T = T \ 60

H = T Mod 24

D = T \ 24

Print Val(Times); "秒="; D; "日"; H; "時(shí)"; M; "分"; S; "秒"

End Sub

VB.NET 如何將秒轉(zhuǎn)化為小時(shí),分鐘,秒的形式

Public Class Form1

Private Function ZToFSAll(ByVal ZT As Long) As String

'全存樣式

'從天,時(shí),分,秒整合為秒

Dim T, S, F, M As Integer '天,時(shí),分,秒

Dim T1, S1 As Integer '天,時(shí),分,秒

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 M 10 Then

M1 = "0" M

Else

M1 = M

End If

ZToFSAll = T "天" S "小時(shí)" F "分鐘" M1 "秒"

End Function

Private Function ZToFSQS(ByVal ZT As Long) As String

'缺損樣式

'從秒分解為天,時(shí),分,秒

Dim T, S, F, M As Integer '天,時(shí),分,秒

Dim T1, S1 As Integer '天,時(shí),分,秒

Dim T2, S2, F2, M2 As String '天,時(shí),分,秒

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 "小時(shí)"

End If

If F = 0 Then

F2 = ""

Else

F2 = F "分鐘"

End If

M2 = M "秒"

ZToFSQS = T2 S2 F2 M2

End Function

Private Function FSoZT(ByVal T As Integer, ByVal S As Int16, ByVal F As Int16, ByVal M As Int16) As Long

'從天,時(shí),分,秒分解為秒

'T, S, F, M分別為天,時(shí),分,秒

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小時(shí)32分鐘34秒

TextBox1.Text = FSoZT(6, 0, 32, 34) '值為:520354

End Sub。

輸入一個(gè)整數(shù),表示秒數(shù),將其轉(zhuǎn)化為天,小時(shí) 分 秒 輸出.

Dim?day?As?Integer,?hour?As?Integer,?minute?As?Integer,?second?As?Integer,?temp?As?Integer

temp?=?Val(TextBox.Text)

second?=?temp?Mod?60

temp?=?(temp?-?second)?/?60

minute?=?temp?Mod?60

temp?=?(temp?-?minute)?/?60

hour?=?temp?Mod?24

day?=?(temp?-?hour)?/?24

MsgBox?Str(day)??"天"??hour??"小時(shí)"??minute??"分"??second??"秒"

VB.net 中如何將秒數(shù)轉(zhuǎn)換為分鐘或者小時(shí)

假設(shè)你得到 N 秒

那么,一個(gè)小時(shí)就是 3600 秒,一分鐘就是 60 秒,我們就可以這樣子分割出來 :

小時(shí) hour = N / 3600;

分鐘 minute = ( N - ( hour * 3600 ) ) / 60;

秒 second = N - ( hour * 3600 + minute * 60 );

然后自己按照 hour : minute : second 的格式打印出來就行了 。


新聞名稱:秒轉(zhuǎn)換成天vb.net,秒轉(zhuǎn)換成小時(shí)
鏈接分享:http://weahome.cn/article/hcsgsp.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部