Re: unix timestamp
| From: | andy | Date: | Fri, 06 Sep 2002 13:33:30 +0000 |
| Subject: | Re: unix timestamp | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115464@lists.php.net to get a copy of this message | ||
Hi everybody,
here is the code which does unfortunatelly not work as I want. The goal is
to produce a unix timestamp which is a date 7 days ago and one 14 days ago
and so on.
code:
switch ($ts){
case 1: // today
$timestamp = mktime (0,0,0,date("m") ,date("d"),date("Y"));
break;
case 2: // yesterday
$timestamp = mktime (0,0,0,date("m"),date("d")-1, date("Y"));
break;
case 2: // last week
$timestamp = mktime (0,0,0,date("m"),date("d")-7, date("Y"));
break;
}
Maybe someone can see the error?
Thank you for any help on that.
Andy
<nicos@php.net> schrieb im Newsbeitrag
news:20020906122409.89100.qmail@pb1.pair.com...
> You should use mktime()
>
> mktime
> (PHP 3, PHP 4 )
>
> mktime -- Get UNIX timestamp for a date
> Description
> int mktime ( int hour, int minute, int second, int month, int day, int
year
> [, int is_dst])
>
> www.php.net/mktime
>
> --
>
> Nicos - CHAILLAN Nicolas
> nicos@php.net
> www.WorldAKT.com - Hébergement de sites Internet
>
> "Andy" <news.letters@gmx.de> a écrit dans le message de news:
> 20020906113551.53211.qmail@pb1.pair.com...
> > Hi everybody,
> >
> > I am trying to create a unix timestamp which dates back a certain amount
> of
> > days. Lets say I would like to have a unix timestamp from 7 days ago.
> >
> > what I tryed is just to subtract values since this are counted s since
the
> > start of the unix epoche, but this does not work in cases like the
switch
> of
> > months. Has anybody an idea how to do that?
> >
> > Thanx, Andy
> >
> >
>
>