1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2a8d6fec8Smseidel 3ce44d6c1SAndrew Rist<!--*********************************************************** 4a8d6fec8Smseidel * 5ce44d6c1SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 6ce44d6c1SAndrew Rist * or more contributor license agreements. See the NOTICE file 7ce44d6c1SAndrew Rist * distributed with this work for additional information 8ce44d6c1SAndrew Rist * regarding copyright ownership. The ASF licenses this file 9ce44d6c1SAndrew Rist * to you under the Apache License, Version 2.0 (the 10ce44d6c1SAndrew Rist * "License"); you may not use this file except in compliance 11ce44d6c1SAndrew Rist * with the License. You may obtain a copy of the License at 12a8d6fec8Smseidel * 13ce44d6c1SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 14a8d6fec8Smseidel * 15ce44d6c1SAndrew Rist * Unless required by applicable law or agreed to in writing, 16ce44d6c1SAndrew Rist * software distributed under the License is distributed on an 17ce44d6c1SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18ce44d6c1SAndrew Rist * KIND, either express or implied. See the License for the 19ce44d6c1SAndrew Rist * specific language governing permissions and limitations 20ce44d6c1SAndrew Rist * under the License. 21a8d6fec8Smseidel * 22ce44d6c1SAndrew Rist ***********************************************************--> 23ce44d6c1SAndrew Rist 24a8d6fec8Smseidel<helpdocument version="1.0"> 25cdf0e10cSrcweir<meta> 26a8d6fec8Smseidel<topic id="textscalcguidecalc_datexml" indexer="include" status="PUBLISH"> 27a8d6fec8Smseidel<title xml-lang="en-US" id="tit">Calculating With Dates and Times</title> 28a8d6fec8Smseidel<filename>/text/scalc/guide/calc_date.xhp</filename> 29a8d6fec8Smseidel</topic> 30a8d6fec8Smseidel</meta> 31a8d6fec8Smseidel<body> 32*82a98929Smseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3146120"> 33*82a98929Smseidel<bookmark_value>dates; in cells</bookmark_value> 34a8d6fec8Smseidel<bookmark_value>times; in cells</bookmark_value> 35a8d6fec8Smseidel<bookmark_value>cells;date and time formats</bookmark_value> 36a8d6fec8Smseidel<bookmark_value>current date and time values</bookmark_value> 37cdf0e10cSrcweir</bookmark> 38cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3146120" role="heading" level="1" l10n="U" 39a8d6fec8Smseideloldref="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> 40cdf0e10cSrcweir</variable></paragraph> 41a8d6fec8Smseidel<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> 42a8d6fec8Smseidel<list type="ordered"> 43a8d6fec8Smseidel<listitem> 44a8d6fec8Smseidel<paragraph xml-lang="en-US" id="par_id3150750" role="listitem" l10n="U" oldref="13">In a spreadsheet, enter your birthday in cell A1.</paragraph> 45a8d6fec8Smseidel</listitem> 46a8d6fec8Smseidel<listitem> 47a8d6fec8Smseidel<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> 48a8d6fec8Smseidel</paragraph> 49a8d6fec8Smseidel</listitem> 50a8d6fec8Smseidel<listitem> 51a8d6fec8Smseidel<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> 52a8d6fec8Smseidel</listitem> 53a8d6fec8Smseidel<listitem> 54a8d6fec8Smseidel<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> 55a8d6fec8Smseidel</listitem> 56a8d6fec8Smseidel<listitem> 57a8d6fec8Smseidel<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> 58a8d6fec8Smseidel</listitem> 59a8d6fec8Smseidel<listitem> 60a8d6fec8Smseidel<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> 61a8d6fec8Smseidel</listitem> 62a8d6fec8Smseidel<listitem> 63a8d6fec8Smseidel<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> 64a8d6fec8Smseidel</listitem> 65a8d6fec8Smseidel</list> 66a8d6fec8Smseidel<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> 67a8d6fec8Smseidel<section id="relatedtopics"> 68a8d6fec8Smseidel<embed href="text/scalc/guide/calc_timevalues.xhp#calc_timevalues"/> 69a8d6fec8Smseidel</section> 70a8d6fec8Smseidel</body> 71a8d6fec8Smseidel</helpdocument> 72