在VB中如何格式化时间
怎么把时间20:30:45格式化成203045。本人是个菜鸟,若高手回答的正确详细,本人追加10分,绝对不食言。...
怎么把时间20:30:45格式化成203045。本人是个菜鸟,若高手回答的正确详细,本人追加10分,绝对不食言。
展开
3个回答
展开全部
Dim a As String
Dim b As String
a = "20:30:45"
b = a.Substring(0, 2) & a.Substring(3, 2) & a.Substring(6, 2)
Me.TextBox1.Text = b
这样不知道行不?
或者
Dim d As Date
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim x As String
d = Date.Now()
a = d.Hour
b = d.Minute
c = d.Second
x = a & b & c
Me.TextBox2.Text = x
秒的话如果是个位你把它最好format一下比如1秒就是01
Dim b As String
a = "20:30:45"
b = a.Substring(0, 2) & a.Substring(3, 2) & a.Substring(6, 2)
Me.TextBox1.Text = b
这样不知道行不?
或者
Dim d As Date
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim x As String
d = Date.Now()
a = d.Hour
b = d.Minute
c = d.Second
x = a & b & c
Me.TextBox2.Text = x
秒的话如果是个位你把它最好format一下比如1秒就是01
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
format(time,"HHNNSS")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
dim pStr_Time as string
pStr_Time = "20:30:45"
format(pStr_Time,"HHMMSS")
pStr_Time = "20:30:45"
format(pStr_Time,"HHMMSS")
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询