cvs commit: perlfaq perlfaq4.pod

[email protected] (brian d foy) 10 Aug 2005 15:55:50 -0000
Newsgroups perl.cvs.perlfaq
Message-ID <[email protected]>
cvsuser     05/08/10 08:55:50

  Modified:    .        perlfaq4.pod
  Log:
  * spelling and grammar fixes
  
  * How can I compare two dates and find the difference?
     + rewrote answer to mention the several Date packages on CP
  
  Revision  Changes    Path
  1.67      +8 -11     perlfaq/perlfaq4.pod
  
  Index: perlfaq4.pod
  ===================================================================
  RCS file: /cvs/public/perlfaq/perlfaq4.pod,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- perlfaq4.pod	6 Aug 2005 06:55:54 -0000	1.66
  +++ perlfaq4.pod	10 Aug 2005 15:55:49 -0000	1.67
  @@ -409,7 +409,7 @@
   	my $week_of_year = strftime "%W",
   		localtime( timelocal( 0, 0, 0, 18, 11, 1987 ) );
   
  -The Date::Calc module provides two functions for to calculate these.
  +The Date::Calc module provides two functions to calculate these.
   
   	use Date::Calc;
   	my $day_of_year  = Day_of_Year(  1987, 12, 18 );
  @@ -436,15 +436,12 @@
   
   =head2 How can I compare two dates and find the difference?
   
  -If you're storing your dates as epoch seconds then simply subtract one
  -from the other.  If you've got a structured date (distinct year, day,
  -month, hour, minute, seconds values), then for reasons of accessibility,
  -simplicity, and efficiency, merely use either timelocal or timegm (from
  -the Time::Local module in the standard distribution) to reduce structured
  -dates to epoch seconds.  However, if you don't know the precise format of
  -your dates, then you should probably use either of the Date::Manip and
  -Date::Calc modules from CPAN before you go hacking up your own parsing
  -routine to handle arbitrary date formats.
  +(contributed by brian d foy)
  +
  +You could just store all your dates as a number and then subtract. Life
  +isn't always that simple though. If you want to work with formatted
  +dates, the Date::Manip, Date::Calc, or DateTime modules can help you.
  +
   
   =head2 How can I take a string and turn it into epoch seconds?