Re: Date and time issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I assume you are trying to insert into a mysql table column that is a date.

insert into table (datecol) values (from_unixtime($new_exp_day));

Example output of from_unixtime:

+---------------------------+
| from_unixtime(1000000000) |
+---------------------------+
| 2001-09-08 21:46:40       |
+---------------------------+

Peter

On Mon, 4 Nov 2002, Frederik Feys wrote:

> 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
>

---------------------------------------------------------------------------
Peter Beckman            Systems Engineer, Fairfax Cable Access Corporation
beckman@purplecow.com                             http://www.purplecow.com/
---------------------------------------------------------------------------


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux