军事时间格式,如何在格式中添加+ 1天 [英] Military Time format, How can add + 1 to days in format

查看:178
本文介绍了军事时间格式,如何在格式中添加+ 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 to DateTime[^] objects using one of the Parse methods, then you can just use the AddDays method to increment it.


这篇关于军事时间格式,如何在格式中添加+ 1天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆