RE: [PHP-DB] Date Subtraction

2002-08-21 Thread Hutchins, Richard

Manoj,

Just a couple of thoughts:
First, I know this particular topic has been discussed here recently, so you
might want to search the archives for more exhaustive information.

Second, if you're using MySQL, check out the functions DATE_ADD() and MOD().
They're MySQL functions, so you'll have to implement them in your query, not
the actual PHP code itself. These may or may not give you what you're
looking for. You might have to drop the value of some kind of PHP variable
into the DATE_ADD() INTERVAL parameter or something though.

I looked quickly through the date functions in the PHP documentation and
didn't find anything that would really manipulate the date for you (of
course I may have missed it). The one thing that I did notice is that the
PHP date and time functions return the SERVER date and time to you, not the
local time for the user accessing your page. That might not be what you
want. As I said before, I might have missed something, but that's what I
found out after looking for all of two minutes.

Rich
-Original Message-
From: Manoj Japher [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 2:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Date Subtraction


hi,
  Is there any way I can get previous day's date, like we get 
current
date by using getdate() or date() function. I mean is there some
in-built function in PHP which can subtract date to give me
yesterday's date.
  I am currently calculating it using some code, which I have 
written
and it is very tirng and recursive to check for each possible 
case.

  If someone has solved this before pls let me know.

Thanks,

Regards,

Manoj


'I have miles to go before I sleep, and promises to keep'

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

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




Re: [PHP-DB] Date Subtraction

2002-08-21 Thread Jason Wong

On Thursday 22 August 2002 02:23, Manoj Japher wrote:
 hi,
   Is there any way I can get previous day's date, like we get
 current
 date by using getdate() or date() function. I mean is there some
 in-built function in PHP which can subtract date to give me
 yesterday's date.
   I am currently calculating it using some code, which I have
 written
 and it is very tirng and recursive to check for each possible
 case.

   If someone has solved this before pls let me know.

mktime()

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
The person who makes no mistakes does not usually make anything.
*/


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




RE: [PHP-DB] Date Subtraction

2002-08-21 Thread Hutchins, Richard

Oh, in MySQL, there's also DATE_SUB(). Forgot to mention that one.

Rich

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 2:40 PM
To: 'Manoj Japher'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Date Subtraction


Manoj,

Just a couple of thoughts:
First, I know this particular topic has been discussed here recently, so you
might want to search the archives for more exhaustive information.

Second, if you're using MySQL, check out the functions DATE_ADD() and MOD().
They're MySQL functions, so you'll have to implement them in your query, not
the actual PHP code itself. These may or may not give you what you're
looking for. You might have to drop the value of some kind of PHP variable
into the DATE_ADD() INTERVAL parameter or something though.

I looked quickly through the date functions in the PHP documentation and
didn't find anything that would really manipulate the date for you (of
course I may have missed it). The one thing that I did notice is that the
PHP date and time functions return the SERVER date and time to you, not the
local time for the user accessing your page. That might not be what you
want. As I said before, I might have missed something, but that's what I
found out after looking for all of two minutes.

Rich
-Original Message-
From: Manoj Japher [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 2:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Date Subtraction


hi,
  Is there any way I can get previous day's date, like we get 
current
date by using getdate() or date() function. I mean is there some
in-built function in PHP which can subtract date to give me
yesterday's date.
  I am currently calculating it using some code, which I have 
written
and it is very tirng and recursive to check for each possible 
case.

  If someone has solved this before pls let me know.

Thanks,

Regards,

Manoj


'I have miles to go before I sleep, and promises to keep'

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

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

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




Re: Re: [PHP-DB] Date Subtraction

2002-08-21 Thread Manoj Japher

hi,
  hey you are bang on target. It did solve my problem.

Thanks a lot,

Manoj

On Wed, 21 Aug 2002 [EMAIL PROTECTED] wrote :

if you really just want yesterday, i use date(Y-m-d, time() -
86400);

that way you'll get the correct info, no matter if it spans 
weeks,
months,
years etc

i realize there could be flaws with this b/c it just subtracts
24hours, but
it works



 Manoj  Japher
 manojjapher@redif   To:
[EMAIL PROTECTED]
 fmail.com   cc:
  Subject: 
[PHP-DB]
Date Subtraction
 08/21/2002 02:23
 PM
 Please respond to
 Manoj  Japher






hi,
   Is there any way I can get previous day's date, like we get
current
date by using getdate() or date() function. I mean is there 
some
in-built function in PHP which can subtract date to give me
yesterday's date.
   I am currently calculating it using some code, which I have
written
and it is very tirng and recursive to check for each possible
case.

   If someone has solved this before pls let me know.

Thanks,

Regards,

Manoj


'I have miles to go before I sleep, and promises to keep'

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






'I have miles to go before I sleep, and promises to keep'

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




RE: [PHP-DB] Date Subtraction

2002-08-21 Thread Ryan Jameson (USA)

What's more you can do some neat stuff with manipulating the timestamp to create very 
quick and accurate calendars. For instance for an application I had to build I had 
need of highlighting weeks on a calendar to change colors every two weeks, but any 
given day needed to know which color it should show. Since the increment of the 
timestamp is so predictible you can use the mod operator and do all kinds of neat 
stuff. Anyway, just another 2 cents worth.

 Ryan

-Original Message-
From: Manoj Japher [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 1:04 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Date Subtraction


hi,
  hey you are bang on target. It did solve my problem.

Thanks a lot,

Manoj

On Wed, 21 Aug 2002 [EMAIL PROTECTED] wrote :

if you really just want yesterday, i use date(Y-m-d, time() -
86400);

that way you'll get the correct info, no matter if it spans 
weeks,
months,
years etc

i realize there could be flaws with this b/c it just subtracts
24hours, but
it works



 Manoj  Japher
 manojjapher@redif   To:
[EMAIL PROTECTED]
 fmail.com   cc:
  Subject: 
[PHP-DB]
Date Subtraction
 08/21/2002 02:23
 PM
 Please respond to
 Manoj  Japher






hi,
   Is there any way I can get previous day's date, like we get
current
date by using getdate() or date() function. I mean is there 
some
in-built function in PHP which can subtract date to give me
yesterday's date.
   I am currently calculating it using some code, which I have
written
and it is very tirng and recursive to check for each possible
case.

   If someone has solved this before pls let me know.

Thanks,

Regards,

Manoj


'I have miles to go before I sleep, and promises to keep'

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






'I have miles to go before I sleep, and promises to keep'

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


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