军事时间格式,如何在格式中添加+ 1天 [英] Military Time format, How can add + 1 to days in format
本文介绍了军事时间格式,如何在格式中添加+ 1天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
军事时间格式,如果小时数达到24,如何在日期格式mm / dd / yyyy中添加+ 1天。
Textbox7.Text表示结果
time.Text represtents ##。## mm / dd / yyyy - 这是我的问题
Military Time format, How can I add + 1 to days in date format of mm/dd/yyyy, if hours reach 24.
Textbox7.Text Represents the result
time.Text represtents ##.## mm/dd/yyyy - this is my problem
TextBox7.Text = Format(Val(TextBox6.Text) + Val(Strings.Left(time.Text.Trim,5)),"##.00")
'if minutes reach 60"
If Val(TextBox7.Text.Trim.Split(".")(1)) >= 60 Then
TextBox7.Text = Val(TextBox7.Text.Trim.Split(".")(0)) + 1 & "." & Val(TextBox7.Text.Trim.Split(".")(1) - 60) & Format(Now, "MM/dd/yyyy")Else
TextBox7.Text = Format(Val(TextBox6.Text) + Val(Strings.Left(time.Text.Trim, 5)),"##.00") & Strings.Right(time.Text.Trim, 11)
End If
'Do here, if hours reach 24"
If Val(TextBox7.Text.Trim.Split(".")(0)) >= 24 Then
TextBox7.Text = Val(TextBox7.Text.Trim.Split(".")(0)) - 24 & "." & Val(TextBox7.Text.Trim.Split(".")(1)) & Format(Now, "MM/dd/yyyy")End If
推荐答案
您应该将文本值转换为DateTime
[ ^ ]使用其中一个Parse的对象
方法,然后你可以使用AddDays
方法来增加它。
You should convert the text values toDateTime
[^] objects using one of theParse
methods, then you can just use theAddDays
method to increment it.
这篇关于军事时间格式,如何在格式中添加+ 1天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文