summaryrefslogtreecommitdiffstats
path: root/helpcontent2/source/text/scalc/guide/calc_date.xhp
blob: 7eeda013d92fb5cd477e66e5ca345f14686082b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="UTF-8"?>


<!--***********************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * $RCSfile: calc_date.xhp,v $
 * $Revision: 1.6 $
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************-->
	
<helpdocument version="1.0">
<meta>
<topic id="textscalcguidecalc_datexml" indexer="include" status="PUBLISH">
<title id="tit" xml-lang="en-US">Calculating With Dates and Times</title>
<filename>/text/scalc/guide/calc_date.xhp</filename>
</topic>
<history>
<created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created>
<lastedited date="2005-07-26T14:55:52">FPE: Screenshot deleted
YJ: checked</lastedited>
</history>
</meta>
<body>
<bookmark xml-lang="en-US" branch="index" id="bm_id3146120"><bookmark_value>dates; in cells</bookmark_value>
<bookmark_value>times; in cells</bookmark_value>
<bookmark_value>cells;date and time formats</bookmark_value>
<bookmark_value>current date and time values</bookmark_value>
</bookmark>
<paragraph role="heading" id="hd_id3146120" xml-lang="en-US" level="1" l10n="U" 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>
</variable></paragraph>
<paragraph role="paragraph" id="par_id3154320" xml-lang="en-US" 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>
<list type="ordered">
<listitem>
<paragraph role="listitem" id="par_id3150750" xml-lang="en-US" l10n="U" oldref="13">In a spreadsheet, enter your birthday in cell A1.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3145642" xml-lang="en-US" l10n="U" oldref="14">Enter the following formula in cell A3: =NOW()-A1</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3149020" xml-lang="en-US" 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>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3155335" xml-lang="en-US" l10n="U" oldref="53">Place the cursor in cell A3, right-click to open a context menu and choose <emph>Format Cells</emph>.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3147343" xml-lang="en-US" l10n="U" oldref="54">The <emph>Format Cells</emph> dialog appears. On the <emph>Numbers</emph> tab, the <emph>Number</emph> 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.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3147001" xml-lang="en-US" l10n="U" oldref="15">The number of days between today's date and the specified date is displayed in cell A3.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3150304" xml-lang="en-US" 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>
</listitem>
</list>
<paragraph role="paragraph" id="par_id3149207" xml-lang="en-US" 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>
<section id="relatedtopics">
<embed href="text/scalc/guide/calc_timevalues.xhp#calc_timevalues"/>
</section>
</body>
</helpdocument>