Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How can I show the exact date and time vs time ago?

+3 votes
318 views
asked Apr 24, 2011 in Q2A Core by anonymous
Can it even be done for posts before a certain period?

1 Answer

0 votes
answered May 8, 2011 by Scott

I think this is possible. You'll need to edit your advanced theme. Currently the HTML on this page comes out like:

<span class="qa-q-view-when">
  <span class="qa-q-view-when-data">
    <span class="published">
      <span class="value-title" title="2011-04-24T19:39:37+0000"></span>
      2 weeks
    </span>
  </span>
  <span class="qa-q-view-when-pad"> ago</span>
</span>

(I actually think this is a bug...shouldn't the "2 weeks" text be inside the span that has the title?)

I think you'd need to scrap most of the superfluous elements and go with this format. Note this is just what the result would look like, you'll need to do some digging to find exactly what you need to change and where.

 

<span class="qa-q-view-when" title="2011-04-24T19:39:37+0000">2 weeks ago</span>

Then simply use this jQuery:

$('.qa-q-view-when').timeago();

 

...