RE: [PHP] simple date/now() question

2004-09-28 Thread Jay Blanchard
[snip]
data like:

20040928170708
20040916163619
etc

Anybody have a function for this? or can help? am a
bit confused because reading on google I see that
there are 2 possible problems as MySql has its own
time and PHP its own time (most of the time!)
[/snip]

http://www.php.net/date
http://www.php.net/time

You jsut have to accept how MySQL stores a dattime stamp, if you know
how to read it you can manipulate with several time/date functions in
PHP. Taking one of your stamps above...

20040916163619

2004-09-16 16:36:19

Then you can test to see if 16:36:19 if greater than or less than 24
hours ago

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



Re: [PHP] simple date/now() question

2004-09-28 Thread Jason Davidson
Just select out records that are NOW() - (24 * 60 * 60)or if you use
datetime field instead of timestamp, which is prolly better off ofr many
reasons, use DATE_SUB(NOW(), INTERVAL 1 DAY) or something similar.  you
can get timestamps from datetime fields, if that is an issue for you...

Jason

Mag [EMAIL PROTECTED] wrote: 
 
 Hi,
 I have a field in the db called 
 
 join_date_time(timestamp 14) 
 
 which has data like:
 
 20040928170708
 20040916163619
 etc
 
 This keeps track of the customer join date, I need to
 know if the client has joined in the last 24hrs or
 more than 24hrs back...
 
 Anybody have a function for this? or can help? am a
 bit confused because reading on google I see that
 there are 2 possible problems as MySql has its own
 time and PHP its own time (most of the time!)
 
 Thanks,
 Mag
 
 =
 --
 - The faulty interface lies between the chair and the keyboard.
 - Creativity is great, but plagiarism is faster!
 - Smile, everyone loves a moron. :-)
 
 
   
 ___
 Do you Yahoo!?
 Declare Yourself - Register online to vote today!
 http://vote.yahoo.com
 
 -- 
 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] simple date/now() question

2004-09-28 Thread Mag
Hi,
Thanks for replying.

 Just select out records that are NOW() - (24 * 60 *
 60)

I just need this for 1 record, when the user logs in I
want to know if he has joined more than 1 day back or
not...


I am looking into php.net/date and php.net/time, but
if  have an example for me...:-)

Thanks,
Ryan

or if you use
 datetime field instead of timestamp, which is prolly
 better off ofr many
 reasons, use DATE_SUB(NOW(), INTERVAL 1 DAY) or
 something similar.  you
 can get timestamps from datetime fields, if that is
 an issue for you...
 
 Jason
 
 Mag [EMAIL PROTECTED] wrote: 
  
  Hi,
  I have a field in the db called 
  
  join_date_time(timestamp 14) 
  
  which has data like:
  
  20040928170708
  20040916163619
  etc
  
  This keeps track of the customer join date, I need
 to
  know if the client has joined in the last 24hrs or
  more than 24hrs back...
  
  Anybody have a function for this? or can help? am
 a
  bit confused because reading on google I see that
  there are 2 possible problems as MySql has its own
  time and PHP its own time (most of the time!)
  
  Thanks,
  Mag
  
  =
  --
  - The faulty interface lies between the chair and
 the keyboard.
  - Creativity is great, but plagiarism is faster!
  - Smile, everyone loves a moron. :-)
  
  
  
  ___
  Do you Yahoo!?
  Declare Yourself - Register online to vote today!
  http://vote.yahoo.com
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit:
 http://www.php.net/unsub.php
  
  
 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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