This file is indexed.

/usr/share/perl5/Date/Manip/Examples.pod is in libdate-manip-perl 6.25-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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# Copyright (c) 1995-2011 Sullivan Beck. All rights reserved.
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.

=pod

=head1 NAME

Date::Manip::Examples - examples of how to use Date::Manip

=head1 DESCRIPTION

This document includes a number of examples on how to do common
Date::Manip operations.  I will be happy to add new examples over
time, and welcome suggestions and examples to include.

In most cases, an example will include two different ways of getting
the answer.  The first way will be using the new (as of 6.00) OO
modules. The second will be using the old-style functional interface.

It should be noted that any time you want to work with alternate
time zones, the OO interface is STRONGLY recommended since the functional
interface does not preserve time zone information with the date, and
may therefore give incorrect results in some cases. However, working
in the time zone of the system should give correct results.

It should be noted that, in the examples below, it appears that the
OO method takes a lot more lines of code than the functional interface.
There are a number of ways to shorten the OO method, but for the
examples, I wanted to include all the steps explicitly.

=head1 PARSING A DATE

Dates can be parsed in practically any form in common usage:

=over 4

=item B<OO method>

   $date = new Date::Manip::Date;
   $err = $date->parse("today");
   $err = $date->parse("1st Thursday in June 1992");
   $err = $date->parse("05/10/93");
   $err = $date->parse("12:30 Dec 12th 1880");
   $err = $date->parse("8:00pm December tenth");

=item B<Functional>

   $date = ParseDate("today");
   $date = ParseDate("1st Thursday in June 1992");
   $date = ParseDate("05/10/93");
   $date = ParseDate("12:30 Dec 12th 1880");
   $date = ParseDate("8:00pm December tenth");

=back

The Date::Manip::Date manual has a list of all valid formats.

=head1 PARSING AN AMOUNT OF TIME

Amounts of time (referred to as deltas) can also be parsed:

=over 4

=item B<OO method>

   $delta = new Date::Manip::Delta;
   $err = $delta->parse("in 12 hours");
   $err = $delta->parse("-0:1:30:0");
   $err = $delta->parse("4 business days later");

=item B<Functional>

   $delta = ParseDateDelta("in 12 hours");
   $delta = ParseDateDelta("-0:1:30:0");
   $delta = ParseDateDelta("4 business days later");

=back

=head1 TO CALCULATE THE AMOUNT OF TIME BETWEEN TWO DATES

   $datestr1 = "Jan 30 1999 13:00 EST";
   $datestr2 = "2/Mar/1999 15:30:00 +0500";

=over 4

=item B<OO method>

   $date1 = new Date::Manip::Date;
   $date2 = $date1->new_date();
   $err = $date1->parse($datestr1);
   $err = $date2->parse($datestr2);

To get an exact amount of time between the two dates (expressed only in terms of
weeks, days, hours, minutes, seconds), use:

   $delta = $date1->calc($date2);

To get an approximate amount of time (expressed in terms of years, months, weeks,
etc. in terms that a human would typically think of), use:

   $delta = $date1->calc($date2,"approx");

=item B<Functional>

   $date1 = ParseDate($string1);
   $date2 = ParseDate($string2);

To get an exact amount:

   $delta = DateCalc($date1,$date2);

and the approximate amount:

   $delta = DateCalc($date1,$date2,1);

=back

The Date::Manip::Calc manual has information about these, and other types of
calculations.

=head1 TO ADD AN AMOUNT OF TIME TO A DATE

To find a second date a given amount of time before or after a first date,
use the following:

   $datestr  = "Jan 30 1999 13:00 EST";
   $deltastr = "12 hours ago";
   $deltastr = "in 3 business days";

=over 4

=item B<OO method>

   $date = new Date::Manip::Date;
   $delta = $date->new_delta();
   $date->parse($datestr);
   $delta->parse($deltastr);

   $d = $date->calc($delta);
 
=item B<Functional>

   $date = DateCalc($datestr,$deltastr);

=back

If the delta is a business delta, it will do a business mode calculation.

The Date::Manip::Calc manual has information about these, and other types of
calculations.

=head1 COMPARE TWO DATES

To take two different dates and see which is earlier, do the
following:

   $datestr1 = "Jan 30 1999 13:00 EST";
   $datestr2 = "2/Mar/1999 15:30:00 +0500";

=over 4

=item B<OO method>

   $date1 = new Date::Manip::Date;
   $date2 = $date1->new_date;
   $date1->parse($datestr1);
   $date2->parse($datestr2);

   $date1->cmp($date2);
      => -1, 0, 1

=item B<Functional>

   $date1 = ParseDate($datestr1);
   $date2 = ParseDate($datestr2);

   Date_Cmp($date1,$date2);
      => -1, 0, 1

=back

=head1 TO EXTRACT INFORMATION ABOUT A DATE OR DELTA

If you have a date or a delta, you can extract information
about them as follows:

   $datestr  = "1:24:08 PM EST Feb 3, 1996";
   $deltastr = "12 hours ago";

=over 4

=item B<OO method>

   $date = new Date::Manip::Date;
   $delta = $date->new_delta();
   $date->parse($datestr);
   $delta->parse($deltastr);

   $date->printf("It is now %T on %b %e, %Y.");
     =>  "It is now 13:24:08 on Feb  3, 1996."

   $delta->printf("In %hv hours, %mv minutes, %sv seconds");
     => "In -12 hours, 0 minutes, 0 seconds";

=item B<Functional>

   UnixDate($datestr,"It is now %T on %b %e, %Y.");
     =>  "It is now 13:24:08 on Feb  3, 1996."

   Delta_Format($deltastr,"In %hv hours, %mv minutes, %sv seconds");
     => "In -12 hours, 0 minutes, 0 seconds";

=back

The Date::Manip::Date manual contains all of the format codes that can
be used to extract information from a date. The Date::Manip::Delta manual
contains the codes for a delta.

=head1 WORKING WITH EPOCH

Date::Manip can easily be used to work with the number of seconds
since the epoch (Jan 1, 1970 00:00:00 UTC).

If you have a date, and you want to find out how many seconds it is
after the epoch, you can do it in the following ways:

   $datestr  = "1999-04-30-15:30:00 EDT";
   $secs  = 1234567;

=over 4

=item B<OO method>

To find out how many seconds have elapsed on a certain date, you
can do the following:

   $date     = new Date::Manip::Date;
   $err      = $date->parse($datestr);

   $date->printf('%s');
      => number of seconds

To find out the date that is a certain number of seconds since the
epoch, you can use the following:

   $date  = new Date::Manip::Date;
   $err   = $date->parse("epoch $secs");

   $date now contains the date wanted (in the local time zone)

=item B<Functional>

To find out how many seconds have elapsed:

   UnixDate($datestr,'%s');
     => number of seconds
 
To find the date that is a number of seconds since the epoch:

   ParseDateString("epoch $secs");

=back

Note that Date::Manip will work with both positive seconds (for dates
that have come since the epoch) and negative seconds (for dates that
occurred before the epoch).

=head1 RECURRING EVENTS

To find a list of dates where a recurring event happens (even very complex
recurrences), do the following:

=over 4

=item B<OO method>

  # To find the 2nd Tuesday of every month from Jan 1 1999 to Apr 30 1999

  $recur = new Date::Manip::Recur;
  $start = $recur->new_date();
  $end   = $recur->new_date();
  $start->parse("Jan 1 1999");
  $end->parse("Apr 30 1999");

  $recur->parse("0:1*2:2:0:0:0",$start,$end);
  @date = $recur->dates();

  # To find the Monday after Easter in 1997-1999

  $recur = new Date::Manip::Recur;
  $recur->parse("*1997-1999:0:0:0:0:0:0*EASTER,ND1");
  @date = $recur->dates();

=item B<Functional>

  # To find the 2nd Tuesday of every month from Jan 1 1999 to Apr 30 1999
  @date = ParseRecur("0:1*2:2:0:0:0","","Jan 1 1999","Apr 30 1999");

  # To find the Monday after Easter in 1997-1999.
  @date = ParseRecur("*1997-1999:0:0:0:0:0:0*EASTER,ND1");

=back

The Date::Manip::Recur manual contains information about recurring events.

=head1 WORKING WITH DATES IN ANOTHER LANGUAGE

If you want to work with dates in a language other than English (but you
are only working with a single language), do the following:

=over 4

=item B<OO method>

   $date = new Date::Manip::Date;
   $date->config("Language","French","DateFormat","non-US");
   $date->parse("1er decembre 1990");

=item B<Functional>

   Date_Init("Language=French","DateFormat=non-US");
   $date = ParseDate("1er decembre 1990");

=back

The Date::Manip::Config manual has a list of all supported languages (in the
section on the Language config variable). The meaning of the DateFormat
config variable is also included.

=head1 WORKING WITH TWO DIFFERENT LANGUAGES

If you want to work with dates in two (or more) languages, it is STRONGLY
recommended that you use the OO interface. The functional interface will
be much slower since it has to re-initialize a lot of language-specific
stuff every time you switch back and forth between languages.

=over 4

=item B<OO method>

   $date_eng = new Date::Manip::Date;
   $date_eng->config("Language","English","DateFormat","US");

   $date_fre = new Date::Manip::Date;
   $date_fre->config("Language","French","DateFormat","non-US");

Use the $date_eng object to do English operations, the $date_fre object to
do French operations.

=item B<Functional>

If you are working with both French and English dates, you can call
the following to switch between them:

   Date_Init("Language=French","DateFormat=non-US");
   Date_Init("Language=English","DateFormat=US");

This is NOT recommended. Use the OO method instead.

=back

=head1 BUGS AND QUESTIONS

Please refer to the Date::Manip::Problems documentation for
information on submitting bug reports or questions to the author.

=head1 SEE ALSO

Date::Manip        - main module documentation

=head1 LICENSE

This script is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

=head1 AUTHOR

Sullivan Beck (sbeck@cpan.org)

=cut