Date formatting problem

Forums › Forums › Search & Filter Pro › Date formatting problem

Tagged: ,

Viewing 3 posts – 1 through 3 (of 3 total)
  • Anonymous
    #106100

    Hi guys, i’m trying to make a date-pagination system using get parameters of search filter pro, but i have problem with date formatting. This is my url example:

    example.com/?post_type=rassegna&_sfm_data_rassegna=04052017

    I’m trying to get “date” value but that:

    $day = strtotime($_GET['_sfm_data_rassegna']);
    $fmt_day = date("Y-m-d", $day);

    Print nothing. If I print $day i get the right parameter.
    What’s happening? (PHP Version 5.6.21)

    Anonymous
    #106108

    Solved:

    if($_GET['_sfm_data_rassegna'] != ''){
    	$day=$_GET['_sfm_data_rassegna'];
    	$dr= date_create_from_format('dmY', $day);
    	$fmt_day = $dr->format('Y-m-d');
    } else {
    	$fmt_day = date('Y-m-d');
    }
    Trevor
    #106134

    Make sure that the changes I just made do not affect this? Please let me know if it is an issue.

Viewing 3 posts – 1 through 3 (of 3 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.