By shinamee
I’m trying to setup a commenting system in Codeigniter with jquery-timeago plugin which seems to be fine on my localhost but on the server, it keeps showing 6hours ago for new comments.
Any thought?
Thanks.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
As @kcristella said, you will need to make sure that your local timezone and your server’s timezone match because jquery-timeago runs on the client and thus uses the local timezone, but processes the date that the server returned, which matches the server’s timezone.
However, this would not work for visitors with different timezones, so you will want to calculate the x time ago part on the server itself and not in the browser. Another option would be converting the time to the visitor’s timezone and then jquery-timeago will work correctly.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.