Re: Change Date
| From: | Thomas Seifert | Date: | Sat, 11 Jan 2003 14:08:30 +0000 |
| Subject: | Re: Change Date | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131249@lists.php.net to get a copy of this message | ||
i.e.
// getting the current time in an array
$timeval=localtime();
// we want the time 3 hours in the future
$timeval[2] = $timeval[2]+3;
// calc the new timestamp
$timestamp=mktime ($timeval[2], $timeval[1], $timeval[0], $timeval[4], $timeval[3], i$timeval[5]);
########################
An even better solution, you are talking about a unix-timestamp, right?
just add or subtract the the seconds from the current timestamp,
i.e.
// get the current timestamp
$timestamp=time();
// 1 minute = 60 seconds, 1 hour = 60 minutes, therefore 1 hour = 60*60 = 3600 seconds
// so we add 3600*3 to have the time in 3 hours
$timestamp = $timestamp + (3600*3);
// you can convert this time back to a readable format using strftime
############
Regards,
Thomas
On Sun, 11 Jan 2004 16:22:08 +0330 ss@yazd.info (Sadeq Naqashzade) wrote:
>
> So Thanks, but can you get me some example code?
>
> Regards,
> Sadeq
>
> "Thomas Seifert" <thomas.seifert@myphorum.de> wrote in message
> news:20030111134834.0d70d923.thomas.seifert@myphorum.de...
> > http://de.php.net/manual/en/function.mktime.php
> >
> > The most important part is
> > "mktime() is useful for doing date arithmetic and validation, as it will
> automatically calculate the correct value for out-of-range input."
> >
> >
> >
> > Thomas
> >
> > On Sun, 11 Jan 2004 16:12:01 +0330 ss@yazd.info (Sadeq Naqashzade) wrote:
> >
> > > Hi,
> > > How can I find time stamp for example 125 next days. or 03:30 hours
> next?
> > >
> > > Regards,
> > > S. Naqashzade
> > > PS: Sorry for my bad english :-(
> > >
> > >
>
>