RE: [PHP] Re: [PHP-DB] How to add 2 years to todays date ?

2002-03-18 Thread Ford, Mike [LSS]

> -Original Message-
> From: Andrey Hristov [mailto:[EMAIL PROTECTED]]
> Sent: 18 March 2002 08:20
> 
> $your_timestamp+=gmmktime(0,0,0,1,1,1972);

Well, that depends on your definition of "year" -- the problem here is that it makes 
no allowances for leap years, so (for example) 2-mar-2003 would be converted to 
1-mar-2005 (since 29-feb-2004 would be effectively "lost").

Both the other solutions offered would cope with this, but personally I like the 
strtotime("+2 years") one best!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




Re: [PHP] Re: [PHP-DB] How to add 2 years to todays date ?

2002-03-18 Thread Tom Rogers

Hi
A variation

echo date("d/m/Y",strtotime("+2 years"))

Tom

At 06:29 PM 18/03/2002, Martin Schichl wrote:


>At 10:19 18.03.02 +0200, "Andrey Hristov" <[EMAIL PROTECTED]> wrote:
> >$your_timestamp+=gmmktime(0,0,0,1,1,1972);
>
>Try:
>
>$your_timestamp =
>mktime(date("H"),date("i"),date("s"),date("m"),date("d"),(date("Y")+2));
>
>Is there anything why this would not work?
>
>Martin
>
>
>
>-
>Dipl.-Ing. Martin Schichl
>SC&C Software, Communication & Consulting GmbH & Co KEG
>Grottenhofstr. 3, A-8053 Graz
>Tel. +43/(0)316/265-205, Fax +43/(0)316/265-234
>[EMAIL PROTECTED], http://scc.co.at
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP] Re: [PHP-DB] How to add 2 years to todays date ?

2002-03-18 Thread Martin Schichl

At 10:35 18.03.02 +0200, Andrey wrote:
>Isn't the hack with gmmktime() faster? It is clean if the code knows 
>what is 1,1,1970 and how Unixtime is measured.

Seems that you'r right, as 

mktime(date("H"),date("i"),date("s"),date("m"),date("d"),(date("Y")+2))

calls six times the function "date" ...

Martin


-
Dipl.-Ing. Martin Schichl
SC&C Software, Communication & Consulting GmbH & Co KEG
Grottenhofstr. 3, A-8053 Graz
Tel. +43/(0)316/265-205, Fax +43/(0)316/265-234
[EMAIL PROTECTED], http://scc.co.at


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




Re: [PHP] Re: [PHP-DB] How to add 2 years to todays date ?

2002-03-18 Thread Andrey Hristov

Isn't the hack with gmmktime() faster? It is clean if the code knows what is 1,1,1970 
and how Unixtime is measured.

Andrey

- Original Message - 
From: "Martin Schichl" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 18, 2002 10:29 AM
Subject: Re: [PHP] Re: [PHP-DB] How to add 2 years to todays date ?


> 
> 
> At 10:19 18.03.02 +0200, "Andrey Hristov" <[EMAIL PROTECTED]> wrote:
> >$your_timestamp+=gmmktime(0,0,0,1,1,1972);
> 
> Try:
> 
> $your_timestamp =
> mktime(date("H"),date("i"),date("s"),date("m"),date("d"),(date("Y")+2));
> 
> Is there anything why this would not work?
> 
> Martin
> 
> 
> 
> -
> Dipl.-Ing. Martin Schichl
> SC&C Software, Communication & Consulting GmbH & Co KEG
> Grottenhofstr. 3, A-8053 Graz
> Tel. +43/(0)316/265-205, Fax +43/(0)316/265-234
> [EMAIL PROTECTED], http://scc.co.at
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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




Re: [PHP] Re: [PHP-DB] How to add 2 years to todays date ?

2002-03-18 Thread Martin Schichl



At 10:19 18.03.02 +0200, "Andrey Hristov" <[EMAIL PROTECTED]> wrote:
>$your_timestamp+=gmmktime(0,0,0,1,1,1972);

Try:

$your_timestamp =
mktime(date("H"),date("i"),date("s"),date("m"),date("d"),(date("Y")+2));

Is there anything why this would not work?

Martin



-
Dipl.-Ing. Martin Schichl
SC&C Software, Communication & Consulting GmbH & Co KEG
Grottenhofstr. 3, A-8053 Graz
Tel. +43/(0)316/265-205, Fax +43/(0)316/265-234
[EMAIL PROTECTED], http://scc.co.at


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