WordPress.org

Support

Support » Plugins and Hacks » Change date format?

Change date format?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Yeah not sure why the plugin author has that dms3_format function outputting the date in ISO time or whatever weird format this is 00-37-1446. It’s easy to fix though.

    In the fb_event_list.php file find this line (92):

    $start_date=dms3_format($start_date);

    and change it to this:

    $start_date=date('F j, Y', $start_date);

    You can replace the ‘F j, Y’ i have in there with any php date characters: http://php.net/manual/en/function.date.php

    Hmm – tried noyz319’s solution and I got “January 1 1970”, which I think is the first day of the universe according to UNIX. I think this means that $start_date=$values[‘start_time’], called on line 91, isn’t giving us a proper date to work with.

    I went back and changed the dms3_format function that begins on line 29 to parse it into a real date like so:

    function dms3_format($yyyy_mm_ddT) {
    	$t=substr($yyyy_mm_ddT,11,5); // get the time value only
    	$d=substr($yyyy_mm_ddT,0,10); //get date separately from the time
    	$d=date("l, F j, Y", strtotime($d)); //format date output
    	$t12  = date("g:i a", strtotime($t)); //convert from 24 to 12 hour time
    	return $d." - ".$t12;
    }

    That gives me output that looks like this: Saturday, January 25, 2014 – 8:00 pm.

    This doesn’t output the end time, nor deal with an event that spans more than one day, but I’ll deal with that later. It appears from the commented out code in the file that the author had some difficulties with that issue.

    And – Important! – I’ll keep a backup copy of this file so that it isn’t overwritten by a plugin update.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change date format?’ is closed to new replies.