Perad Posted January 20, 2007 Share Posted January 20, 2007 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 https://forums.phpfreaks.com/topic/34977-time-and-how-to-addsubtract-it/ Share on other sites More sharing options...
Daniel0 Posted January 20, 2007 Share Posted January 20, 2007 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 https://forums.phpfreaks.com/topic/34977-time-and-how-to-addsubtract-it/#findComment-164972 Share on other sites More sharing options...
konnwat Posted January 20, 2007 Share Posted January 20, 2007 its the servertime and it must have been retrieved with the time() functiontry [URL=http://uk.php.net/time]http://uk.php.net/time[/URL] Link to comment https://forums.phpfreaks.com/topic/34977-time-and-how-to-addsubtract-it/#findComment-164973 Share on other sites More sharing options...
Daniel0 Posted January 20, 2007 Share Posted January 20, 2007 Great job on repeating what I said...Besides, it mustn't be retrieved be retrieved with [url=http://php.net/time]time()[/url], there are several other functions that will give you the time of the server. Link to comment https://forums.phpfreaks.com/topic/34977-time-and-how-to-addsubtract-it/#findComment-164975 Share on other sites More sharing options...
SharkBait Posted January 20, 2007 Share Posted January 20, 2007 He's response wasn't that far away from yours ;) Link to comment https://forums.phpfreaks.com/topic/34977-time-and-how-to-addsubtract-it/#findComment-165022 Share on other sites More sharing options...
Hypnos Posted January 20, 2007 Share Posted January 20, 2007 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.htmlIf 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 https://forums.phpfreaks.com/topic/34977-time-and-how-to-addsubtract-it/#findComment-165036 Share on other sites More sharing options...
konnwat Posted January 20, 2007 Share Posted January 20, 2007 yeah i started posting that post and then the forum said someone else had posted but i didn't go back and read what you said so i just posted. sorry bout that ;) Link to comment https://forums.phpfreaks.com/topic/34977-time-and-how-to-addsubtract-it/#findComment-165111 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.