以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  date与date的相加  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=88956)

--  作者:lur320
--  发布时间:2016/8/12 11:17:00
--  date与date的相加


图片点击可在新窗口打开查看此主题相关图片如下:capture.png
图片点击可在新窗口打开查看
如图,

1是date

2是date

3是整数

 

如何在datachanged里面写代码来计算1+2。

 

1+3是比较简单的,用addhours就可以。但是在日前后面加上几点钟开始,这两个data的向加就不会了。


--  作者:lur320
--  发布时间:2016/8/12 11:18:00
--  

错了,停线结束的时刻是1+2+3

 


--  作者:lur320
--  发布时间:2016/8/12 11:22:00
--  

用 & 也报错:

If e.DataRow.IsNull("预期停线日期") Or e.DataRow.IsNull("预期停线耗时") Or e.DataRow.IsNull("预期停线时刻") Then
    e.DataRow("停线开始")= Nothing
   
Else
    \'MessageBox.Show("")
    Dim a As Date=e.DataRow("预期停线日期")
Dim b As Date = e.DataRow("预期停线时刻")
Dim c As Date

e.DataRow("停线开始")=c & b
   
End If

 


--  作者:lur320
--  发布时间:2016/8/12 11:26:00
--  

代码错了。。。。。发现要加一个空格可以连接

 

e.DataRow("停线开始")=a & " " & b


--  作者:cbt
--  发布时间:2016/8/12 11:31:00
--  
 Dim a As String ="2008-12-11"
Dim b As String = "12:12"
Dim t As Date = a & " " & b
t=t.AddHours(2)
output.show(t)