Forums

Get help. Give help. A Web Design and Development Community.

How to Calculate Days B/W to given Dates

  • # June 18, 2012 at 12:43 pm

    I Want to Know that how can i calculate the no. of days b/w the two given dates using php

    # June 18, 2012 at 3:36 pm

    This reply has been reported for inappropriate content.

    if you have the dates, convert them to unix timestamp, subtract the earliest date from the latest and then convert it back to number of days.


    $early = mktime(hour,minute,second,month,day,year,daylight savings?); //all of these are optional but should be set to 0 if not used.
    $late = mktime(hour,minute,second,month,day,year,daylight savings?);

    $days = ($late-$early)/86400; //number of seconds in a day

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We have a pretty good* newsletter.