Support » Fixing WordPress » plugin for length work

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    Probably not, because the calculation using timestamps (seconds since UNIX Epoch) is fairly straight forward. As a basic example, you could put this on a template:

    $worked = (time() - strtotime('24-06-2015'))/YEAR_IN_SECONDS; // date is start date
    echo "Adam has been with for us for $worked years";

    The number will be something like 3.9811951737697 years, less than ideal. This concept clearly needs further refinement. It would be a matter of using a different divisor and doing some additional arithmetic and rounding. Maybe start by using DAY_IN_SECONDS instead.

Viewing 1 replies (of 1 total)
  • The topic ‘plugin for length work’ is closed to new replies.