Date::EzDate

Date and time manipulation made easy
Download

Date::EzDate Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Miko O'Sullivan
  • Publisher web site:
  • http://search.cpan.org/~miko/

Date::EzDate Tags


Date::EzDate Description

Date and time manipulation made easy Developer commentsDate::EzDate is a Perl module motivated by the simple fact that I hate dealing with date and time calculations, so I put all of them into a single easy-to-use object. The main idea of EzDate is that the object represents a specific date and time. A variety of properties tell you information about that date and time such as hour, minute, day of month, weekday, etc.The real power of EzDate is that you can assign to (almost) any of those properties and EzDate will automatically rework the other properties to produce a new valid date with the property you just assigned. Properties that can be kept the same with the new value aren't changed, while those that logically must change to accomodate the new value are recalculated. For example, incrementing epochday by one (i.e. moving the date forward one day) does not change the hour or minute but does change the day of week.So, for example, suppose you want to get information about today, then get information about tomorrow. That can be done using the epochday property which is used for day-granularity calculations. Let's walk through the steps:Load the module and instantiate the object use Date::EzDate; my $mydate = Date::EzDate->new(); # the object defaults to the current date and timeoutput all the basic information # e.g. outputs: 11:11:40 Wed Apr 11, 2001 print $mydate->{'full'}, " ";set to tomorrow To move the date forward one day we simply increment the epochday property (number of days since the epoch). The time (i.e. hour:min:sec) of the object does not change. $mydate->{'epochday'}++; # outputs: 11:11:40 Thu Apr 12, 2001 print $mydate->{'full'}, " ";This demonstrates the basic concept: almost any of the properties can be set as well as read and EzDate will take care of resetting all other properties as needed. Requirements: · Perl What's New in This Release: · Last version supported by Miko O'Sullivan. No changes to code, just added the note about EzDate no longer being supported.


Date::EzDate Related Software