使用日期和时间进行计算

在 LibreOffice Calc 中,尽管日期和时间均以计算机的内部时钟为基准,可以对日期和时间数据进行计算。例如,要查看您的准确年龄(以秒或小时为单位),请执行以下操作:

  1. 在一个电子表格中,在单元格 A1 中输入您的出生日期。

  2. 在单元格 A3 中输入以下公式:=NOW()-A1

  3. 按下 Enter 键后,您将看到以日期格式显示的计算结果。如果要查看两个日期之间相差的天数,则必须将单元格 A3 格式化为数字形式。

  4. 将光标置于单元格 A3 处,右键单击打开上下文菜单,然后选择单元格格式化

  5. 将显示单元格格式对话框。在数字选项卡中,已突出显示“数字”类别。此格式被设为“常规”,因此,当计算结果中含有日期条目时,结果将以日期形式显示。如果要以数字形式显示结果,请将数字格式设为 "-1,234",然后单击确定按钮关闭对话框。

  6. 在单元格 A3 中显示的是今天与指定日期之间相隔的天数。

  7. 在单元格 A4 中键入计算小时的公式:=A3*24,在单元格 A5 中键入计算分钟的公式:=A4*60,在单元格 A6 中键入计算秒钟数的公式:=A5*60,然后如上所述分别确认输入。

The time since your date of birth will be calculated and displayed in the various units. The values are calculated as of the exact moment when you entered the last formula and pressed the Enter key. This value is not automatically updated, although "Now" continuously changes. In the Data menu, the menu item Calculate - AutoCalculate is normally active; however, automatic calculation does not apply to the function NOW. This ensures that your computer is not solely occupied with updating the sheet.