![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
VB中如何把日期和时间拼接在一起
rq=2009-12-7text1.text=20text2.text=13text1是小时text2是分钟riqi=2009-12-720:13(riqi为时间类型)r...
rq = 2009-12-7
text1.text = 20
text2.text = 13
text1是小时
text2是分钟
riqi = 2009-12-7 20:13(riqi为时间类型)
riqi1 = 2009-12-7 20:33(riqi1比riqi晚20分钟,可以一直累加)
请高手指点,谢谢
hms = Format(LCT.wHour, "00") & Format(LCT.wMinute + 10, "00")
我不是取的系统时间,时间是在text文本里输入的,如果输入53分的话,加10就成63分了,怎样让他变成3分同时小时+1 展开
text1.text = 20
text2.text = 13
text1是小时
text2是分钟
riqi = 2009-12-7 20:13(riqi为时间类型)
riqi1 = 2009-12-7 20:33(riqi1比riqi晚20分钟,可以一直累加)
请高手指点,谢谢
hms = Format(LCT.wHour, "00") & Format(LCT.wMinute + 10, "00")
我不是取的系统时间,时间是在text文本里输入的,如果输入53分的话,加10就成63分了,怎样让他变成3分同时小时+1 展开
展开全部
建立一个新窗体 放上5个文本框 一个按钮 然后复制我的代码
然后运行就能达到你的要求
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer, d As Integer, riqi, riqi1
a = Text1.Text '输入小时
b = Text2.Text '输入分钟
c = Text3.Text '输入想要累加的分钟
d = (b + c) Mod 60 '让他变成3分同时小时+1
e = a + (b + c) \ 60 '让他变成3分同时小时+1
riqi = a & ":" & b '累加前的时间
riqi1 = e & ":" & d '累加后的时间
Text4.Text = riqi '输出累加前的时间
Text5.Text = riqi1 '输出累加后的时间
End Sub
VB6.0测试通过 而且每一步都给你说明了 这样详细分数应该给我吧
然后运行就能达到你的要求
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer, d As Integer, riqi, riqi1
a = Text1.Text '输入小时
b = Text2.Text '输入分钟
c = Text3.Text '输入想要累加的分钟
d = (b + c) Mod 60 '让他变成3分同时小时+1
e = a + (b + c) \ 60 '让他变成3分同时小时+1
riqi = a & ":" & b '累加前的时间
riqi1 = e & ":" & d '累加后的时间
Text4.Text = riqi '输出累加前的时间
Text5.Text = riqi1 '输出累加后的时间
End Sub
VB6.0测试通过 而且每一步都给你说明了 这样详细分数应该给我吧
展开全部
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Private Sub Command1_Click()
Dim LCT As SYSTEMTIME
Dim ymd As String, hms As String
GetLocalTime LCT
ymd = Format(LCT.wYear & "/" & LCT.wMonth & "/" & LCT.wDay, "yyyy/MM/dd")
hms = Format(LCT.wHour & ":" & LCT.wMinute & ":" & LCT.wSecond, "##:##:##") '& ":" & LCT.wMilliseconds :###
ymd = Format(LCT.wYear & "/" & LCT.wMonth & "/" & LCT.wDay, "yyyyMMdd")
hms = Format(LCT.wHour, "00") & Format(LCT.wMinute + 10, "00") & Format(LCT.wSecond, "00")
MsgBox ymd & " " & hms
End Sub
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Private Sub Command1_Click()
Dim LCT As SYSTEMTIME
Dim ymd As String, hms As String
GetLocalTime LCT
ymd = Format(LCT.wYear & "/" & LCT.wMonth & "/" & LCT.wDay, "yyyy/MM/dd")
hms = Format(LCT.wHour & ":" & LCT.wMinute & ":" & LCT.wSecond, "##:##:##") '& ":" & LCT.wMilliseconds :###
ymd = Format(LCT.wYear & "/" & LCT.wMonth & "/" & LCT.wDay, "yyyyMMdd")
hms = Format(LCT.wHour, "00") & Format(LCT.wMinute + 10, "00") & Format(LCT.wSecond, "00")
MsgBox ymd & " " & hms
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询