Calculation of time elapsed in PHP

Today I would like to write some code about calculating time elapsed in PHP. Especially if we want to know the elapsed time of inserted records (seconds, minutes, hours , days etc).

For example – Posted 1 週前、3 時間前、50 分間前、30秒間前。

Here is our function to calculate the time eclipse

I have included the comments in code so that you can be able to understand it. Let’s call our function to test.

PS. we have to care about our server timezone when we are dealing with Datetime functions

By Yuuma



アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム