![]() |
UNIX timestamps
I worked out thanks to someone here at .org how to put a unix timestamp into a readable format with the date() function :)
Now say if im inserting time() into a field in a table e.g. [sql] UPDATE timer SET time='".time()."'; [/sql] How would i adapt that query to add a year to the current time? Thanks in Advance - miSt |
WTF bug in the sql code alert ;)
It was meant to read: UPDATE timer SET time='"time()'"; - miSt |
erm. '". isn't a sql query, you are trying to mix up php and mysql so you should use php or code tags :)
updateing timefield to add a year: [sql]UPDATE timer SET time=time+3600*24*356[/sql] |
|
time() returns a date in epochs which implicitly has the year.
|
I had to do this in the end ;)
PHP Code:
|
What does the +3153600 do? Being the time is from the Epoch, it will have year.. I am still unsure why you are adding the extra numbers in :\
|
It simply adds a year to the current timestamp outputted from the time() function :)
- miSt |
All times are GMT. The time now is 08:03 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|