I am coding an App which users can post and it keeps a timestamp. I generate the timestamp in PHP using date('Y-m-d H:i:s')
. Then when I display the posts the App calculates the time difference in c# to display in time ago such as 1 day ago or 1 hour ago and when you view post info it shows the exact date in the database.
The problem is when I create a post it displays as 8 hours ago since the PHP database isn't in the same timezone as the phone. I was thinking about calculating the time ago in the PHP but then in the post date, it would be off.
Also I can't do it off the devices time in case the user changes their settings then they can change their date back years and post which will create a bug.