Support

Account

Forum Replies Created

  • Hey Dan,

    You, sir, are a hero ๐Ÿ™‚

    That worked perfectly I literally followed your steps and it worked no problem ๐Ÿ™‚ Thank you.

    I have just had a glance at the link you supplied too and will definitely read into it more as there is a chance we could use this type of functionality more within other areas of the site and what you have helped me with there is outstanding.

    Thank you again, very much ๐Ÿ™‚

    Darren

  • Hi,

    I have been trying to calculate a member of staff’s years of service and have had some success following this guide ๐Ÿ™‚

    This is working great, however, I would really like to display the result as “14th Year of Service” or “3rd Year of Service” and can’t figure it out could you offer some guidance please? I have been looking into it and it looks like oridnal suffix is what I am looking for.

    My PHP code is:

    <p class=”start-date”> <?php if( get_sub_field(‘startdate’) ): ?> <?php $date = get_sub_field(‘startdate’); $yearsofservice = new DateTime($date); $interval = $yearsofservice->diff(new DateTime); echo $interval->y. ‘ Year of Service’; ?></p> <?php endif; ?>

    Thank you in advance

    Darren

  • Hi,

    I have been trying to calculate a member of staff’s years of service and have had some success following this guide ๐Ÿ™‚

    This is working great, however, I would really like to display the result as “14th Year of Service” or “3rd Year of Service” and can’t figure it out could you offer some guidance please? I have been looking into it and it looks like oridnal suffix is what I am looking for.

    My PHP code is:

    <p class=”start-date”> <?php if( get_sub_field(‘startdate’) ): ?> <?php $date = get_sub_field(‘startdate’); $yearsofservice = new DateTime($date); $interval = $yearsofservice->diff(new DateTime); echo $interval->y. ‘ Year of Service’; ?></p> <?php endif; ?>

    Thank you in advance

    Darren

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