COUNTDOWN
Moderator: General Moderators
ok, I just checked and you don't need the length so just do something like this:
that will only work for time values (hour:minute:second). In other words, if you want to stamp the date as well you're going to need to use datetime (year-month-day hour:minute:second).
Code: Select all
ALTER TABLE myTable ADD COLUMN myTimeField timeCode: Select all
select myTimeField from myTable where username = 'bob'Code: Select all
echo date("g:i:s",strtotime($row['time']."+10 seconds"));date() I already told you to research...go do that:echo date("g:i:s",strtotime($row['time']."+10 seconds"));
for the example I posted:
date() takes two arguments, the first is the format you want the date/time formated in (in this case g=hours w/o leading zeros i=minutes with leading zeros s=seconds with leading zeros
the second argument is the variable you want formated, in this case I used another function strtotime() which can do a whole bunch of really cool stuff (Burrito pauses for a moment to give props to whomever created strtotime) for this example I just took your var from the result set and added 10 seconds to it.
go look at those two links for more info...
Thanks Burrito
So... Will this work:
Then to insert the value:
So... Will this work:
Code: Select all
$create = CREATE TABLE stats (oc time NOT NULL,PRIMARY KEY (oc))"e;;Code: Select all
mysql_query("e;INSERT INTO stats (oc) VALUES ('"e;strtotime("e;+120 seconds"e;), "e;\n"e;;"e;')"e;;- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
you gotta play around, make a fake user so it start the timer (ie puts the now() time into the database) then query out what the time looks like. if your useing datetime you will have somthing like YYYY-MM-DD HH-MM-SS then use the php function date() to check how much time has passed. its really quite easy just try some diffrent stuff and play around and im sure you will get it.