Module?Module1
創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設、高性價比虞城網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式虞城網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設找我們,業(yè)務覆蓋虞城地區(qū)。費用合理售后完善,十多年實體公司更值得信賴。
Sub?Main()
Console.WriteLine(DateTimeAdd("01:23:45"))
Console.ReadLine()
End?Sub
'''?summary
'''?獲取時間的累加值
'''?/summary
'''?param?name="sDatetime"/param
'''?returns/returns
'''?remarks/remarks
Private?Function?DateTimeAdd(ByVal?sDatetime?As?String)?As?DateTime
Dim?sysTime?As?DateTime?=?DateTime.Now
Return?sysTime.Add(TimeSpan.Parse(sDatetime))
End?Function
End?Module
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 "經(jīng)過了" 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'));
1、時間可以直接比較大小,定義兩個時間的變量,直接使用或者即可判斷,跟數(shù)據(jù)大小判斷是一樣的
2、時間差值,可以使用DateDiff函數(shù)進行
3、比如取一個現(xiàn)在的時間now,使用Year、month、day、hour、min、sec函數(shù)可以取到now的年份、月、日、小時、分鐘和秒