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)