/usr/share/doc/mailutils-doc/mailutils.html/Relative-items-in-date-strings.html is in mailutils-doc 1:2.99.98-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Published by the Free Software Foundation,
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301, USA
Copyright (C) 1999-2004, 2008-2012 Free Software Foundation,
Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover, and no Back-Cover texts.
A copy of the license is included in the section entitled "GNU Free
Documentation License". -->
<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU Mailutils Manual: Relative items in date strings</title>
<meta name="description" content="GNU Mailutils Manual: Relative items in date strings">
<meta name="keywords" content="GNU Mailutils Manual: Relative items in date strings">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Function-Index.html#Function-Index" rel="index" title="Function Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Date-Input-Formats.html#Date-Input-Formats" rel="up" title="Date Input Formats">
<link href="Pure-numbers-in-date-strings.html#Pure-numbers-in-date-strings" rel="next" title="Pure numbers in date strings">
<link href="Day-of-week-items.html#Day-of-week-items" rel="previous" title="Day of week items">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Relative-items-in-date-strings"></a>
<div class="header">
<p>
Next: <a href="Pure-numbers-in-date-strings.html#Pure-numbers-in-date-strings" accesskey="n" rel="next">Pure numbers in date strings</a>, Previous: <a href="Day-of-week-items.html#Day-of-week-items" accesskey="p" rel="previous">Day of week items</a>, Up: <a href="Date-Input-Formats.html#Date-Input-Formats" accesskey="u" rel="up">Date Input Formats</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-Index.html#Function-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Relative-items-in-date-strings-1"></a>
<h3 class="section">B.6 Relative items in date strings</h3>
<a name="index-relative-items-in-date-strings"></a>
<a name="index-displacement-of-dates"></a>
<p><em>Relative items</em> adjust a date (or the current date if none) forward
or backward. The effects of relative items accumulate. Here are some
examples:
</p>
<div class="example">
<pre class="example">1 year
1 year ago
3 years
2 days
</pre></div>
<a name="index-year-in-date-strings"></a>
<a name="index-month-in-date-strings"></a>
<a name="index-fortnight-in-date-strings"></a>
<a name="index-week-in-date-strings"></a>
<a name="index-day-in-date-strings"></a>
<a name="index-hour-in-date-strings"></a>
<a name="index-minute-in-date-strings"></a>
<p>The unit of time displacement may be selected by the string ‘<samp>year</samp>’
or ‘<samp>month</samp>’ for moving by whole years or months. These are fuzzy
units, as years and months are not all of equal duration. More precise
units are ‘<samp>fortnight</samp>’ which is worth 14 days, ‘<samp>week</samp>’ worth 7
days, ‘<samp>day</samp>’ worth 24 hours, ‘<samp>hour</samp>’ worth 60 minutes,
‘<samp>minute</samp>’ or ‘<samp>min</samp>’ worth 60 seconds, and ‘<samp>second</samp>’ or
‘<samp>sec</samp>’ worth one second. An ‘<samp>s</samp>’ suffix on these units is
accepted and ignored.
</p>
<a name="index-ago-in-date-strings"></a>
<p>The unit of time may be preceded by a multiplier, given as an optionally
signed number. Unsigned numbers are taken as positively signed. No
number at all implies 1 for a multiplier. Following a relative item by
the string ‘<samp>ago</samp>’ is equivalent to preceding the unit by a
multiplier with value <em>-1</em>.
</p>
<a name="index-day-in-date-strings-1"></a>
<a name="index-tomorrow-in-date-strings"></a>
<a name="index-yesterday-in-date-strings"></a>
<p>The string ‘<samp>tomorrow</samp>’ is worth one day in the future (equivalent
to ‘<samp>day</samp>’), the string ‘<samp>yesterday</samp>’ is worth
one day in the past (equivalent to ‘<samp>day ago</samp>’).
</p>
<a name="index-now-in-date-strings"></a>
<a name="index-today-in-date-strings"></a>
<a name="index-this-in-date-strings"></a>
<p>The strings ‘<samp>now</samp>’ or ‘<samp>today</samp>’ are relative items corresponding
to zero-valued time displacement, these strings come from the fact
a zero-valued time displacement represents the current time when not
otherwise changed by previous items. They may be used to stress other
items, like in ‘<samp>12:00 today</samp>’. The string ‘<samp>this</samp>’ also has
the meaning of a zero-valued time displacement, but is preferred in
date strings like ‘<samp>this thursday</samp>’.
</p>
<p>When a relative item causes the resulting date to cross a boundary
where the clocks were adjusted, typically for daylight saving time,
the resulting date and time are adjusted accordingly.
</p>
<p>The fuzz in units can cause problems with relative items. For
example, ‘<samp>2003-07-31 -1 month</samp>’ might evaluate to 2003-07-01,
because 2003-06-31 is an invalid date. To determine the previous
month more reliably, you can ask for the month before the 15th of the
current month. For example:
</p>
<div class="example">
<pre class="example">$ date -R
Thu, 31 Jul 2003 13:02:39 -0700
$ date --date='-1 month' +'Last month was %B?'
Last month was July?
$ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!'
Last month was June!
</pre></div>
<p>Also, take care when manipulating dates around clock changes such as
daylight saving leaps. In a few cases these have added or subtracted
as much as 24 hours from the clock, so it is often wise to adopt
universal time by setting the <code>TZ</code> environment variable to
‘<samp>UTC0</samp>’ before embarking on calendrical calculations.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Pure-numbers-in-date-strings.html#Pure-numbers-in-date-strings" accesskey="n" rel="next">Pure numbers in date strings</a>, Previous: <a href="Day-of-week-items.html#Day-of-week-items" accesskey="p" rel="previous">Day of week items</a>, Up: <a href="Date-Input-Formats.html#Date-Input-Formats" accesskey="u" rel="up">Date Input Formats</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-Index.html#Function-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|