actually, the j should only give you the day of the month and nothing more. If you want the day and the month you need to use “j M”.
The rest should work just as you wrote it if you have access to the variable $topic. Try this:
var_dump( $topic );
and see what it outputs. If there’s nothing or NULL, then you’ll have to populate $topic first.