1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?>
2*b1cdbd2cSJim Jagielski<helpdocument version="1.0">
3*b1cdbd2cSJim Jagielski
4*b1cdbd2cSJim Jagielski<!--***********************************************************
5*b1cdbd2cSJim Jagielski *
6*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
7*b1cdbd2cSJim Jagielski * or more contributor license agreements.  See the NOTICE file
8*b1cdbd2cSJim Jagielski * distributed with this work for additional information
9*b1cdbd2cSJim Jagielski * regarding copyright ownership.  The ASF licenses this file
10*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
11*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
12*b1cdbd2cSJim Jagielski * with the License.  You may obtain a copy of the License at
13*b1cdbd2cSJim Jagielski *
14*b1cdbd2cSJim Jagielski *   http://www.apache.org/licenses/LICENSE-2.0
15*b1cdbd2cSJim Jagielski *
16*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
17*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
18*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19*b1cdbd2cSJim Jagielski * KIND, either express or implied.  See the License for the
20*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
21*b1cdbd2cSJim Jagielski * under the License.
22*b1cdbd2cSJim Jagielski *
23*b1cdbd2cSJim Jagielski ***********************************************************-->
24*b1cdbd2cSJim Jagielski
25*b1cdbd2cSJim Jagielski
26*b1cdbd2cSJim Jagielski
27*b1cdbd2cSJim Jagielski
28*b1cdbd2cSJim Jagielski<meta>
29*b1cdbd2cSJim Jagielski      <topic id="textscalcguidecalc_datexml" indexer="include" status="PUBLISH">
30*b1cdbd2cSJim Jagielski         <title xml-lang="en-US" id="tit">Calculating With Dates and Times</title>
31*b1cdbd2cSJim Jagielski         <filename>/text/scalc/guide/calc_date.xhp</filename>
32*b1cdbd2cSJim Jagielski      </topic>
33*b1cdbd2cSJim Jagielski   </meta>
34*b1cdbd2cSJim Jagielski   <body>
35*b1cdbd2cSJim Jagielski<bookmark xml-lang="en-US" branch="index" id="bm_id3146120"><bookmark_value>dates; in cells</bookmark_value>
36*b1cdbd2cSJim Jagielski      <bookmark_value>times; in cells</bookmark_value>
37*b1cdbd2cSJim Jagielski      <bookmark_value>cells;date and time formats</bookmark_value>
38*b1cdbd2cSJim Jagielski      <bookmark_value>current date and time values</bookmark_value>
39*b1cdbd2cSJim Jagielski</bookmark>
40*b1cdbd2cSJim Jagielski<paragraph xml-lang="en-US" id="hd_id3146120" role="heading" level="1" l10n="U"
41*b1cdbd2cSJim Jagielski                 oldref="11"><variable id="calc_date"><link href="text/scalc/guide/calc_date.xhp" name="Calculating With Dates and Times">Calculating With Dates and Times</link>
42*b1cdbd2cSJim Jagielski</variable></paragraph>
43*b1cdbd2cSJim Jagielski      <paragraph xml-lang="en-US" id="par_id3154320" role="paragraph" l10n="CHG" oldref="12">In $[officename] 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:</paragraph>
44*b1cdbd2cSJim Jagielski      <list type="ordered">
45*b1cdbd2cSJim Jagielski         <listitem>
46*b1cdbd2cSJim Jagielski            <paragraph xml-lang="en-US" id="par_id3150750" role="listitem" l10n="U" oldref="13">In a spreadsheet, enter your birthday in cell A1.</paragraph>
47*b1cdbd2cSJim Jagielski         </listitem>
48*b1cdbd2cSJim Jagielski         <listitem>
49*b1cdbd2cSJim Jagielski            <paragraph xml-lang="en-US" id="par_id3145642" role="listitem" l10n="U" oldref="14">Enter the following formula in cell A3: <item type="literal">=NOW()-A1</item>
50*b1cdbd2cSJim Jagielski            </paragraph>
51*b1cdbd2cSJim Jagielski         </listitem>
52*b1cdbd2cSJim Jagielski         <listitem>
53*b1cdbd2cSJim Jagielski            <paragraph xml-lang="en-US" id="par_id3149020" role="listitem" l10n="U" oldref="52">After pressing the <item type="keycode">Enter</item> 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.</paragraph>
54*b1cdbd2cSJim Jagielski         </listitem>
55*b1cdbd2cSJim Jagielski         <listitem>
56*b1cdbd2cSJim Jagielski            <paragraph xml-lang="en-US" id="par_id3155335" role="listitem" l10n="U" oldref="53">Place the cursor in cell A3, right-click to open a context menu and choose <emph>Format Cells</emph>.</paragraph>
57*b1cdbd2cSJim Jagielski         </listitem>
58*b1cdbd2cSJim Jagielski         <listitem>
59*b1cdbd2cSJim Jagielski            <paragraph xml-lang="en-US" id="par_id3147343" role="listitem" l10n="U" oldref="54">The <item type="menuitem">Format Cells</item> dialog appears. On the <item type="menuitem">Numbers</item> 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 <item type="menuitem">OK</item> button.</paragraph>
60*b1cdbd2cSJim Jagielski         </listitem>
61*b1cdbd2cSJim Jagielski         <listitem>
62*b1cdbd2cSJim Jagielski            <paragraph xml-lang="en-US" id="par_id3147001" role="listitem" l10n="U" oldref="15">The number of days between today's date and the specified date is displayed in cell A3.</paragraph>
63*b1cdbd2cSJim Jagielski         </listitem>
64*b1cdbd2cSJim Jagielski         <listitem>
65*b1cdbd2cSJim Jagielski            <paragraph xml-lang="en-US" id="par_id3150304" role="listitem" l10n="U" oldref="16">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 <item type="keycode">Enter</item> key after each formula.</paragraph>
66*b1cdbd2cSJim Jagielski         </listitem>
67*b1cdbd2cSJim Jagielski      </list>
68*b1cdbd2cSJim Jagielski      <paragraph xml-lang="en-US" id="par_id3149207" role="paragraph" l10n="U" oldref="17">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 <item type="keycode">Enter</item> key. This value is not automatically updated, although "Now" continuously changes. In the <emph>Tools</emph> menu, the menu item <emph>Cell Contents - AutoCalculate</emph> 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.</paragraph>
69*b1cdbd2cSJim Jagielski      <section id="relatedtopics">
70*b1cdbd2cSJim Jagielski         <embed href="text/scalc/guide/calc_timevalues.xhp#calc_timevalues"/>
71*b1cdbd2cSJim Jagielski      </section>
72*b1cdbd2cSJim Jagielski   </body>
73*b1cdbd2cSJim Jagielski</helpdocument>