Re: calculating datetime
| From: | Catalin Trifu | Date: | Sun, 31 Aug 2003 13:27:45 +0000 |
| Subject: | Re: calculating datetime | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161297@lists.php.net to get a copy of this message | ||
Hi,
offset = 1day + 1hour + 10 secs = 24 * 60 * 60 + 60 * 60 + 10 (seconds)
time() + offset = the time you need
or
$now = explode('.', date("d.m.Y.H.i.s", time());
$now is array ( 0 => the day, 1 => the month. aso)
add to the elements of the array the values you need
then turn it back into a timestamp with mktime()
Cheers,
Catalin
"Ryan A" <r@no7.biz> wrote in message
news:001a01c36fc1$ec7e7e70$f081aa51@l2zcaxu7emppqh...
> Hi,
> I have a datetime field in my table, i want to enter a datetime 1 day,1
hour
> and 10 mins into the future from today/the present, how do i calculate
that?
>
> This is for the expiring links/members part of a script i am trying to
> create.
>
>
> I have looked around the archive and google but maybe i didnt find the
> correct thread.
> Google turned up these revelient results but are not too much help:
>
http://forums.devshed.com/showthread.php?threadid=4238&kw=get+current+date+and+time+of+server
>
> useing the date function
> http://www.phpbuilder.com/mail/php-general/2002062/1026.php
> (rasmus)
>
> now()
> http://www.phpbuilder.com/mail/php-general/2002062/1033.php
> (john)
>
> This was very helpful but it brings up the other question of is the local
> php time on the server the same as the one on mysql? Logically it should
be
> but......
>
http://www.google.com/url?sa=U&start=3&q=http://www.phpbuilder.com/manual/ref.datetime.php&e=7391
>
>
>
> Thanks in advance,
> -Ryan
>
>
> We will slaughter you all! - The Iraqi (Dis)information ministers site
> http://MrSahaf.com