• Hi there. Client has asked me if we can change the “XX Days Ago” to simply display the date of the LinkedIn Post. I’ve tried messing around with the $time_ago without much luck. Could you suggest a fix to get the desired results? Thanks.

Viewing 1 replies (of 1 total)
  • @arkadaemos

    Hi! Thank you for writing to the forums.

    (Sorry for the late response.)

    As a hack, I’d say that one way would be to, on line 798 ( https://plugins.trac.www.ads-software.com/browser/company-updates-for-linkedin/trunk/linkedin-company-updates.php#L798 ) of linkedin-company-updates.php, to change this line:
    $time_ago = $this->time_ago( $update_share['timestamp'] );

    , and make it this instead:

    $time_ago = date("j/n/Y, g:i a ", ($update_share['timestamp'] / 1000) );

    One drawback will be that if one does it this way and hacks the code, then next time the plugin gets (auto-) updated, then the hack will be lost. Another drawback is this bypasses the author’s neat time_ago function, which would be a shame.

    Maybe a better way is to make a more elegant solution, like an alternate version of the time_ago function that is controlled by a flag in the plugin options or something, and submit it to the plugin author as a pull request or something.

    My point of posting this hack here is that I hope this initial suggestion at least gets the ball rolling (keeps the conversation going, that is), with one idea of how to make the desired change.

    Descriptive screenshot of how it looks (on my dev site) with the hack in place:

    2017 03 03 linkedin company updates with hack in place

Viewing 1 replies (of 1 total)
  • The topic ‘Change Date Formatting’ is closed to new replies.