[PHP] Re: Any easy way of finding yesterday...?

2001-11-13 Thread Harry Lau

Following is a solution...

$now = getdate();
$today = date(d-m-Y);
$yesterday =
date(d-m-Y,mktime(0,0,0,$today['mon'],$today['mday']-1,$today['year']);
echo(Today is  . $today . and yesterday was  . $yesterday);

Harry Lau [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 It is easy to use the function getDate() to obtain the date of today.
 But instead of writing plenty of conditions,
 is there any easy way to get the date of yesterday?
 Thank you.





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Any easy way of finding yesterday...?

2001-11-13 Thread Harry Lau

Oh what a big mistake...sorry!

$now = getdate();
$today = date(d-m-Y);
$yesterday =
date(d-m-Y,mktime(0,0,0,$now['mon'],$now['mday']-1,$now['year']);
echo(Today is  . $today . and yesterday was  . $yesterday);

Harry Lau [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Following is a solution...

 $now = getdate();
 $today = date(d-m-Y);
 $yesterday =
 date(d-m-Y,mktime(0,0,0,$today['mon'],$today['mday']-1,$today['year']);
 echo(Today is  . $today . and yesterday was  . $yesterday);

 Harry Lau [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  It is easy to use the function getDate() to obtain the date of today.
  But instead of writing plenty of conditions,
  is there any easy way to get the date of yesterday?
  Thank you.
 
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Any easy way of finding yesterday...?

2001-11-13 Thread Henrik Hansen

[EMAIL PROTECTED] (Harry Lau) wrote:

  It is easy to use the function getDate() to obtain the date of today.
  But instead of writing plenty of conditions,
  is there any easy way to get the date of yesterday?

echo date(m-d-Y, mktime(0,0,0,date(n), date(d)-1, date(Y)));

-- 
Henrik Hansen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Any easy way of finding yesterday...?

2001-11-13 Thread _lallous

strtotime('yesterday') should work!

Harry Lau [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 It is easy to use the function getDate() to obtain the date of today.
 But instead of writing plenty of conditions,
 is there any easy way to get the date of yesterday?
 Thank you.





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]