If you are using MySQL, you may profitably investigate the function DATE_ADD( date, INTERVAL ) Ignatius J. Reilly ____________________________________________ ----- Original Message ----- From: "Frederik Feys" <frederikfeys@pandora.be> To: <php-db@lists.php.net> Sent: Monday, November 04, 2002 10:32 PM Subject: Date and time issues > Hi all, > I searched for 5 hours, trying to solve my (newbie?) problem. I want to pick > today's date and add XXX days to it. Its setup to validate membership > period. Now my column is of date type. Aswell, I want to pick current time > and add 1 hour to it. Here aswell, sessions expire after one hour. > Can anybody help me? > Thanks > Fred > My code: > $time = getdate(); > > $yr = $time[year]; > $mn = $time[mon]; > $dy = $time[mday]; > > if (subscr_type==1) { //these users van only work 1 hour > $exp_time=time()+3600; > $new_exp_day = getdate(); > } > else if (subscr_type==3) { //3 months subscription(here time doesn't really > matter) > $offset = 90; > } > else if (subscr_type==12) { //1 year subscriptions > > $offset = 365; > } > > $new_exp_day = strftime("%Y-%m-%d",mktime(0,0,0,$mn,$dy+$offset,$yr)); > > -- > Frederik Feys > > frederikfeys@pandora.be > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php