views:

137

answers:

2

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?

A: 

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.

Rusky
+1  A: 

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.

Sinan Taifour