G
G
gseregai2015-07-05 18:01:29
PHP
gseregai, 2015-07-05 18:01:29

How to convert "in 6 hours" to "6 hours ago" into JS or jquery?

How to change the line with the date the post was added from "in 6 hours" to "6 hours ago"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Ineshin, 2015-07-05
@IonDen

If there is a question of date formatting, then Moment.js is very good at it.

A
Alexander Melekhovets, 2015-07-05
@Blast

Redo? Easy:
But in fact, you do not need to remake the strings, but pass the correct date to the function that forms this string. Let's say instead of (comment_date - now) use (now - comment_date).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question