PHP Classes

datetime difference: calculate datetime difference

Recommend this page to a friend!
  All requests RSS feed  >  datetime difference  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

datetime difference

Edit

Picture of Anant kumar singh by Anant kumar singh - 10 years ago (2015-04-14)

calculate datetime difference

This request is clear and relevant.
This request is not clear or is not relevant.

+2

how to find two date difference . means the product post houre

Ask clarification

2 Recommendations

Very precise date difference: Calculate the days between dates within any years

This class can calculate the days between dates within any years.

It can take as parameter two dates and computes the number of days that go from one date to the other.

The class can take dates go outside the limits of UNIX timestamps before 1970 and after 9999.
This recommendation solves the problem.
This recommendation does not solve the problem.

+1

Picture of zinsou A.A.E.Moïse by zinsou A.A.E.Moïse package author package author Reputation 6835 - 7 years ago (2017-07-20) Comment

compute-the-precise-number-of-days-between-two-dates

  • 1 Comment
  • 1. Picture of zinsou A.A.E.Moïse by zinsou A.A.E.Moïse package author package author - 7 years ago (2017-08-02) Reply

    AS i dig a little more,i find a way based on the same algorithm to compute time difference too.So i provide this other package for datetime difference : Package number https://www.phpclasses.org/package/10412-PHP-compute-the-exact-duration-within-two-dates.html(not yet approved but it will) this package provide a method to return the duration in the format that you have chosen in this set with a parameter to keep null value or not:

    							case "m": float number milleniums
    							case "c": float number  centuries 					
    		 					case "y": float number years
    								
    							case "d": float number days
    								
    							case "h": float number hours
    								
    							case "i": float number minutes
    								
    							case "mc": string((int)millenium and (float) century)
    								
    							case "mcydhis": string(millenium centuries years days hours minutes and seconds)
    								
    							case "cydhis":	string( centuries years days hours minutes and seconds)
    								
    							case "ydhis":	string(years days hours minutes and seconds)
    								
    							case "dhis":	string(days hours minutes and seconds)
    								
    							case "his":	string( hours minutes and seconds)
    								
    							case "is":	string( minutes and seconds)
    								
    							case "s":	seconds
    								
    							default: in seconds
    								;
    


PHP Date Math Class: Perform operations with dates with long year range

This class can perform operations with dates with long year range.

It can perform several operations with dates that can be outside the range of 1970 and 2038.

Currently it can add a period to a date, calculate the age relatively to a given birth date, check if a date is valid, convert a date to the Julian calendar, get the date day of the month, week or year, calculate the difference between two dates, get the first day or the end day of the current, prior or next week, month, or year, compare dates and get the latest, etc..
This recommendation solves the problem.
This recommendation does not solve the problem.

+1

Picture of Bob Wedwick by Bob Wedwick package author package author Reputation 30 - 9 years ago (2015-05-13) Comment

This class computes differences between two dates in days, seeks, months, or years but not in hours, minutes, seconds. When times are used, they may affect the computation by plus or minus one. Time may be formatted as AM/PM or 24-hour time. Dates can have several different formats.


Recommend package
: 
: