luke kes
asked 6 years ago

Sir,
Once user submits the question, timestamp appears to be wrong. How do we make it to display the right timestamp? Please advise!

3 Answers
Jackie Lord
answered 6 years ago

Hi Luke,
Any more information regarding your issue would help us to solve the issue faster.
By the way, we have raised an issue regarding timestamp on Github, you can check it out at: https://github.com/designwall/DW-Question-Answer/issues/1 
This issue will be fixed in the next release version of the plugin.

Maurice Green
answered 4 years ago

@Jackie

I am having exactly the same problem with Q&A v.1.4.3.3. Using WordPress 4.5.2.

I checked the Github page and the question was closed by bighug in 2013, but the problem is still there.

When I post a question it lists the time as ‘7 hours ago’ which for me would be GMT, not my local PDT. The same timestamp error occurs when I post an answer to a question, but NOT when I post a comment.

Obviously the issue has not been fixed.

Maurice Green
replied 4 years ago

Just checked the question page itself (and the list of questions on the dashboard) and the posting time is CORRECT.

DominicStaff
answered 4 years ago

To resolve the time issue on your site you can do the following solution:

About list question page, you can open the content-question.php file, find line 17.

Replace it with the following code:

$time = human_time_diff( get_post_time( 'U' ), current_time('timestamp'));

you can open the content-single-question.php file and find the line 19.

Replace the following code:

<?php printf( __( '<span>%s%s %s asked %s ago</span>', 'dwqa' ), dwqa_get_author_link( $user_id ), get_avatar( $user_id, 48 ), dwqa_get_author(), dwqa_print_user_badge( $user_id ), human_time_diff( get_post_time( 'U' ) ) ) ?>

With new code:

<?php printf( __( '<span>%s%s %s asked %s ago</span>', 'dwqa' ), dwqa_get_author_link( $user_id ), get_avatar( $user_id, 48 ), dwqa_get_author(), dwqa_print_user_badge( $user_id ), human_time_diff( get_post_time( 'U' ), current_time('timestamp') ) ) ?>

Powered by DW Question & Answer Pro