十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
Module Module1
创新互联-专业网站定制、快速模板网站建设、高性价比虞城网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式虞城网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖虞城地区。费用合理售后完善,十多年实体公司更值得信赖。
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 "经过了" 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、时间可以直接比较大小,定义两个时间的变量,直接使用或者即可判断,跟数据大小判断是一样的
2、时间差值,可以使用DateDiff函数进行
3、比如取一个现在的时间now,使用Year、month、day、hour、min、sec函数可以取到now的年份、月、日、小时、分钟和秒