1

I am curious which is the best way to convert time like this 2008-04-23 into 1 year and 3 days ago

I currently do this in PHP but I am finding a lot of sites do it in javascript, including Stackoverflow

What do you think is the best way, it seems offloading it to the browser with javascript would just slow your app down, yes the big boys are doing it this way?

2 Answers 2

1

If the content is dynamic, do it with Javascript.

If not, do it in whichever is easier for you.

Although this might not apply in this particular case, many of the big websites try to offload some of the computation to client-side (where possible), to lower the load on their servers.

Sign up to request clarification or add additional context in comments.

Comments

0

Doing it in JavaScript makes the server do less. If you're running a big site, it might be useful to speed up script running time to make the server more responsive.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.