重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
使用datediff函数
创新互联网站建设由有经验的网站设计师、开发人员和项目经理组成的专业建站团队,负责网站视觉设计、用户体验优化、交互设计和前端开发等方面的工作,以确保网站外观精美、做网站、网站设计易于使用并且具有良好的响应性。
textbox3.text=datediff("d","textbox1.text","textbox2.text")
说明一下:
“d”表示“天”
还可以用“y”,"m","d","h","n","s"
分别表示“年”“月”“日”“时”“分”“秒”
明天 DateTime.Now.AddDays(1)
昨天 DateTime.Now.AddDays(-1)
格式化用Format()
Public Class Form1
Private Past As Date
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Past = Now
IO.File.AppendAllText("test.txt", Past.ToString, System.Text.Encoding.Default)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Now1 As Date = CDate(IO.File.ReadAllText("test.txt", System.Text.Encoding.Default))
Dim Now2 As Date = Now
MsgBox("从" Now1.ToString "到" Now2.ToString "经过了" CStr(CDate((Now2 - Now1).ToString)))
End Sub
实际情况修改下。
End Class
function getTime2Time($time1, $time2)
{
var time1 = arguments[0], time2 = arguments[1];
time1 = Date.parse(time1)/1000;
time2 = Date.parse(time2)/1000;
var time_ = time1 - time2;
return (time_/(3600*24));
}
document.write(getTime2Time('2016-08-02', '2016-07-02'));