Jump to content

PHP date and time function help


JamesClarke

Recommended Posts

Hi there, what I have been trying to do is add some additional logic.. My problem is I want to stop displaying the month and day after the year 2000? I know I need to add an if and else statement but this is my first actual project and I am a little stuck.. here is the page, it's a plugin for a timeline http://www.llandoveryheritage.org/project-timeline/

 

And the file is attached below.. any help would be appreciated. The plugin code was too long to just post in here, didn't want to cause any slow loading issues for people on a slow connection.. Thanks and I appreciate any help. 

 

annual_archive.php

Link to comment
Share on other sites

  • 4 weeks later...

You need to provide snippets of code rather than entire scripts...

 

However. You problem should be solvable with something like...

 

function is_date_inrange($selected_timestamp) {

    if ($selected_timestamp > strtotime('2000-12-31 23:59:59')) {

        return false;

    }

    return true;

}

 

http://php.net/manual/en/function.strtotime.php

 

There are other approaches but this ought to get you started.

 

Cheers,

Ian

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.