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
https://forums.phpfreaks.com/topic/293029-php-date-and-time-function-help/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.