The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

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.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed