Time 函数

应用对象
Microsoft 365 专属 Access Access 2024 Access 2021 Access 2019 Access 2016

返回一个 Variant (Date) 值,指示当前的系统时间。

语法

时间

备注

若要设置系统时间,请使用 Time 语句。

查询示例

Expression 结果
SELECT Time () AS Expr1 FROM ProductSales GROUP BY Time () ; 返回采用系统时间格式的当前系统“时间”,并显示在列 Expr1 中。
SELECT Time () AS CurrentTime FROM ProductSales GROUP BY Time () ; 返回采用系统时间格式的当前系统“时间”,并显示在 CurrentTime 列中。

VBA 示例

注意

下面的示例演示了在Visual Basic for Applications (VBA) 模块中使用此函数。 有关使用 VBA 的详细信息,请在“搜索”旁边的下拉列表中选择“开发人员参考”,然后在搜索框中输入一个或多个术语。

此示例使用 Time 函数返回当前系统时间。

Dim MyTime
MyTime = Time    ' Return current system time.

选择正确的日期函数