DeMomentSomTres Facebook Events List
Change date format? (3 posts)

  1. ottomek
    Posted 2 years ago #

    I'm not familiar with PHP enough to change the start date format to this:
    July 30, 2015 6:30 pm

    Reading through comments in fb_event_list.php but not sure what to change and where.



  2. noyz319
    Posted 2 years ago #

    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):


    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

  3. webmystery
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • DeMomentSomTres Facebook Events List
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic