News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Adding the start date to the subject area

Started by franhaselden, October 08, 2018, 08:58:09 AM

Previous topic - Next topic

franhaselden

I've managed to add the start date to the subject area so it now reads Started by Member on "Date" in Board

However, for some reason my date gets output in quotes. My code is the following:

<p>
    ', $txt['started_by'], ' <strong>', $topic['first_post']['member']['link'], '</strong>
    on ' . json_encode(date('jS M Y', $topic['first_post']['timestamp'])) . '
    ', $txt['in'], ' <em>', $topic['board']['link'], '</em>
</p>


The output reads, for example:

QuoteStarted by Fran on "6th Oct 2018" in The Cafe

Where are the quotes coming from?

Shambles

Why do you use json_encode?


date('jS M Y', $topic['first_post']['timestamp'])  should return you a string value

franhaselden

Thanks, that was it. I was outputting the data in a console.log previously thus needing the json_encode but didn't need it once I started echoing this out,

Thanks!

Advertisement: