Jump to content

Time and how to add/subtract it.


Perad

Recommended Posts

I just have 2 questions really.

When you make a post on the forum, is the servers time saved to the database? Or is it the time on your computers clock?

Secondly does anyone know of any good articles that explain how to add and subtract time. Mainly hours.
Link to comment
Share on other sites

PHP's time functions return times based on the time of the server.

About subtracting and adding to time:
If you use time() just do it like regular calculations with + or -
If you use a formatted time stamp you can use [url=http://php.net/strtotime]strtotime()[/url]
Link to comment
Share on other sites

MySQL has it's own time and date functions that can store the current time and date in any common format.

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

If you're storing your dates/times in MySQL, it's best to use this stuff, rather than overly complexing it with PHP code.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.