Contents

# Calculating With Dates and Times

In LibreOfficeDev Calc, you can perform calculations with current date and time values. As an example, to find out exactly how old you are in seconds or hours, follow the following steps:

1. In a spreadsheet, enter your birthday in cell A1.

2. Enter the following formula in cell A3: =NOW()-A1

3. After pressing the Enter key you will see the result in date format. Since the result should show the difference between two dates as a number of days, you must format cell A3 as a number.

4. Place the cursor in cell A3, right-click to open a context menu and choose Format Cells.

5. The Format Cells dialog appears. On the Numbers tab, the "Number" category will appear already highlighted. The format is set to "General", which causes the result of a calculation containing date entries to be displayed as a date. To display the result as a number, set the number format to "-1,234" and close the dialog with the OK button.

6. The number of days between today's date and the specified date is displayed in cell A3.

7. Experiment with some additional formulas: in A4 enter =A3*24 to calculate the hours, in A5 enter =A4*60 for the minutes, and in A6 enter =A5*60 for seconds. Press the Enter key after each formula.

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.

Related Topics

Calculating Time Differences