Skip to end of metadata
Go to start of metadata

Zend Framework: Zend_Date_TimeSpan Component Proposal

Proposed Component Name Zend_Date_TimeSpan
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Date_TimeSpan
Proposers Axel Dahl
Zend Liaison TBD
Revision 1.0 - 28 October 2008: Initial Draft. (wiki revision: 11)

Table of Contents

1. Overview

Zend_Date_TimeSpan is a simple but useful component which can be used to quickly calculate the length of time between two different times. It already exists in the .NET framework and is used a lot in calender type functions. It provides a very readable interface and would help avoid the need for developers to explicitly write date difference functions/code as the TimeSpan class would encapsulate this functionality. It is also intended that this class be fully extensible so that developers can override methods at will.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will return the difference between two Zend_Date objects as the total number of days or hours or minutes or seconds or milliseconds.
  • This component will return the days only difference between two Zend_Date objects.
  • This component will return the hours only difference between two Zend_Date objects.
  • This component will return the minutes only difference between two Zend_Date objects.
  • This component will return the seconds only difference between two Zend_Date objects.
  • This component will return the milliseconds only difference between two Zend_Date objects.
  • It will be possible to add/subtract a number of days, hours, minutes, seconds, milliseconds to/from a Zend_Date_TimeSpan object.
  • It will be possible to compare two instances of a Zend_Date_TimeSpan object.
  • This component will allow subclassing.

4. Dependencies on Other Framework Components

  • Zend_Date
  • Zend_Exception

5. Theory of Operation

The component is instantiated with two Zend_Date objects or alternatively a single number of milliseconds.

6. Milestones / Tasks

As already stated this is a simple component and should not take very long to implement. It is basically a port of the .NET TimeSpan structure and I don't anticipate a long development cycle.

  • Milestone 1: Submit proposal [DONE]
  • Milestone 2: Check in working draft class
  • Milestone 3: Add documentation

7. Class Index

  • Zend_Date_TimeSpan

8. Use Cases

UC-01
UC-02

9. Class Skeletons

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jan 21, 2009

    Such a functionallity should be part of Zend_Date and not be integrated in a own additional component.

    A related feature enhancement issue is already available since 14.May.2008.
    But as there are only 2 votes on it, the work has been delayed in favor of other more needed features.

  2. Feb 07, 2011

    Archiving this proposal, feel free to recover it when you want to work on it again. For more details see this email.