August 24th, 2000, 09:54 PM
While i work on my acution site, i need to input into the database the time the user submitted the auction, and the time + the duration of the auction. How can i store these two values in variables.
August 24th, 2000, 10:37 PM
$starttime=date(mktime());//add to db//
$fintime=date(mktime());//add to db//
date(mktime());returns an integer value (seconds since 01/01/1970) for the date, store this both times & you can subtract the difference to get the number of seconds between the 2 dates - then its just a bit of math to work out the time in hours/mins etc.
August 24th, 2000, 11:07 PM
very interesting, care to help me with the math
August 24th, 2000, 11:29 PM
Here's a link to an article I wrote which should help you with calculating the amount of time between events using a UNIX timestamp. I use Perl in the example, but it doesn't matter really that much which language you use, the way to do it is pretty much the same:
hope this helps
<LI> TD Scripts
<LI> Script School
August 24th, 2000, 11:35 PM
I really dont understand this article, i suppose what i can do is get the current time in seconds, then divide it by the number of seconds in a year and add it to 1970, giving me the year, correct? and just repeat this patern for the other elements of time.
I dont understand why i would need any fancy unix functions, but then again, like i said, i dont understand
August 25th, 2000, 03:32 AM
August 25th, 2000, 09:35 AM
Hmmm, if you don't understand that if you subtract a past point in time in seconds from a future point in time in seconds and that the result is the amount of seconds that has elapsed well ... then you better hit the bricks and restudy the concept, because to me, anyway, that makes pretty good sense Nothing "UNIX complicated" about it, I think that is called basic time elapsed.
While writing this response how many seconds have elapsed, maybe 180 seconds? There's 3 minutes!
180 seconds divided by 60 = 3 minutes
Anybody else not understand my article? Maybe I'm in left field and I need to rework it. First time I've received the feedback that conceptually it couldn't be grasped ...
August 26th, 2000, 01:46 AM
Look man, i didnt understand the whole article, dont take offense. I got the gist of the firs half, which is what matters, but the rest wasnt clear to me. I take offense in how you reacted towards my lack of comprehension. Sorry i invaded you by saying i found your delicate code ambiguous. I thought we were here to help one another...
August 26th, 2000, 05:03 AM
errr - your tutorial was good Tdavid - but there is no need to be rude - PHP 'aint PERL whatever anyone says , & because of that .... we can do this! (did not think of it before).
$el is the start date,
$el2 is the finish date
getdate()is way cool!
$elap=$el-$el2;// get difference //
So no Math needed after all (I got a 'U' (unclassified) in Math at school).
August 26th, 2000, 07:42 AM
Yikes I guess smilies don't work on the internet for some people Firepages and RPGswap, please chill out. I wasn't taking offense, I was being genuine in asking for feedback, not trying to be or come across as rude Really
Apparently both of you took my comments above in the wrong way and I apologize but the use of smilies usually means one is SMILING as they say something
Am I here to help people? Doh! Of course Take a look at the date I registered for this forum and see how many people I've already answered questions from Believe me, if I'm going to flame someone, they'll know it, I won't beat around the bush
Let's move on, shall we, and stick to PHP and not getting sensitive? I should have started a different thread and asked for feedback on the article, instead of using a reply to comment here to ask for feedback. While I didn't take offense (actually I was curious and wanted to take feedback to make it better and more lucid) to my article not being comprehended, it is clear to me now that you two thought I did. Thank you for the feedback Good and bad feedback is helpful, really it is
August 26th, 2000, 09:56 PM
LOL - Tdavid -sorry but its funny cos I think that the board has reset your profile - it shows you joined 22nd August this year & have 27 posts! - I have seen you around a long time before that!
I know what you are saying Tdavid but the post came accross as a little condescending, I know its hard to read these things sometimes, so sorry if I got you wrong.
August 27th, 2000, 01:22 AM
its cool tdavid. I understand. Your article isnt bad at all, it just confused me. Its well written and clear, but I think it couldbe better improved by being more thorougly explained once you get into the comparing events in a time section. Firepages-what you just posted was brilliant, screw math, i love you
Thanks again guys, i cant wait til my site is totally done! i know one day ill finish