Viewing 4 replies - 1 through 4 (of 4 total)
  • You need to edit file function.php inside plugin folder; at line 181 you can find the code creating that string.
    Note that DateTime class i’m using requires PHP 5.2.0 or later.
    Just change this:

    $event .= ' <div class="snippet-data-img"> <span itemprop="startDate" datetime="'.$event_start_date.'T00:00-00:00">'.$event_start_date.'</span></div><div class="snippet-clear"></div>';

    into this:

    $myStartDate = DateTime::createFromFormat('m/d/Y', $event_start_date);
    $my_event_start_date = $myStartDate->format('d/m/Y');
    $event .= ' <div class="snippet-data-img"> <span itemprop="startDate" datetime="'.$event_start_date.'T00:00-00:00">'.$my_event_start_date.'</span></div><div class="snippet-clear"></div>';

    You can change EndDate too editing relative variables.

    Thread Starter lacike

    (@lacike)

    Thanks Zenion, that’s what I need and that’s what I was going to modify.

    I was hoping to have this in next version. I don’t like modification of plugins, because the plugin cannot be automatically updated.. However, in this case it seems the plugin is about to be abandoned by the author.

    Thank you very much Zenion !

    mmm, there is a little problem : Google structured data doesn’t read correctly the date, because it reverse day and month. I tried to modify:
    $myStartDate = DateTime::createFromFormat(‘m/d/Y’, $event_start_date);
    with:
    $myStartDate = DateTime::createFromFormat(‘d/m/Y’, $event_start_date);
    but that’s doesn’t work. Do you have any solution ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Dates in WordPress format?’ is closed to new replies.