1*cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2*cdf0e10cSrcweir<helpdocument version="1.0"> 3*cdf0e10cSrcweir 4*cdf0e10cSrcweir<!-- 5*cdf0e10cSrcweir*********************************************************************** 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 12*cdf0e10cSrcweir * 13*cdf0e10cSrcweir * This file is part of OpenOffice.org. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 16*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 17*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 18*cdf0e10cSrcweir * 19*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 20*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 21*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 23*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 24*cdf0e10cSrcweir * 25*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 26*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 27*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 28*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 29*cdf0e10cSrcweir * 30*cdf0e10cSrcweir ************************************************************************ 31*cdf0e10cSrcweir --> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir<meta> 35*cdf0e10cSrcweir <topic id="textscalcguidecalc_datexml" indexer="include" status="PUBLISH"> 36*cdf0e10cSrcweir <title xml-lang="en-US" id="tit">Calculating With Dates and Times</title> 37*cdf0e10cSrcweir <filename>/text/scalc/guide/calc_date.xhp</filename> 38*cdf0e10cSrcweir </topic> 39*cdf0e10cSrcweir </meta> 40*cdf0e10cSrcweir <body> 41*cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="index" id="bm_id3146120"><bookmark_value>dates; in cells</bookmark_value> 42*cdf0e10cSrcweir <bookmark_value>times; in cells</bookmark_value> 43*cdf0e10cSrcweir <bookmark_value>cells;date and time formats</bookmark_value> 44*cdf0e10cSrcweir <bookmark_value>current date and time values</bookmark_value> 45*cdf0e10cSrcweir</bookmark> 46*cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3146120" role="heading" level="1" l10n="U" 47*cdf0e10cSrcweir 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> 48*cdf0e10cSrcweir</variable></paragraph> 49*cdf0e10cSrcweir <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> 50*cdf0e10cSrcweir <list type="ordered"> 51*cdf0e10cSrcweir <listitem> 52*cdf0e10cSrcweir <paragraph xml-lang="en-US" id="par_id3150750" role="listitem" l10n="U" oldref="13">In a spreadsheet, enter your birthday in cell A1.</paragraph> 53*cdf0e10cSrcweir </listitem> 54*cdf0e10cSrcweir <listitem> 55*cdf0e10cSrcweir <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> 56*cdf0e10cSrcweir </paragraph> 57*cdf0e10cSrcweir </listitem> 58*cdf0e10cSrcweir <listitem> 59*cdf0e10cSrcweir <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> 60*cdf0e10cSrcweir </listitem> 61*cdf0e10cSrcweir <listitem> 62*cdf0e10cSrcweir <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> 63*cdf0e10cSrcweir </listitem> 64*cdf0e10cSrcweir <listitem> 65*cdf0e10cSrcweir <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> 66*cdf0e10cSrcweir </listitem> 67*cdf0e10cSrcweir <listitem> 68*cdf0e10cSrcweir <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> 69*cdf0e10cSrcweir </listitem> 70*cdf0e10cSrcweir <listitem> 71*cdf0e10cSrcweir <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> 72*cdf0e10cSrcweir </listitem> 73*cdf0e10cSrcweir </list> 74*cdf0e10cSrcweir <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> 75*cdf0e10cSrcweir <section id="relatedtopics"> 76*cdf0e10cSrcweir <embed href="text/scalc/guide/calc_timevalues.xhp#calc_timevalues"/> 77*cdf0e10cSrcweir </section> 78*cdf0e10cSrcweir </body> 79*cdf0e10cSrcweir</helpdocument>