Re: newbie question

From: Date: Fri, 13 Feb 2004 22:49:41 +0000
Subject: Re: newbie question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-32949@lists.php.net to get a copy of this message
On Fri, 13 Feb 2004, t wrote: > hi, > > i am relatively new to php and new to this email list. > > i have what i think are fairly simple questions about using mysql and > php. i have done some research and can't seem to find the answer i > need. > > # 1. i want to set the date format to display dates in a format other > than the standard mysql yyyy-mm-dd format. i have tried using the mysql > DATE_FORMAT but i can's seem to get it to work... > > ideally i'd like to display dates as 2 digit date followed by three > letter month abbreviation and leave the year off completely... > > example: 13 feb Use date() Documentation: http://php.net/date > # 2. i want to hide entries that are newer than the current date AND > hide entries older than 365 days. Limit your SQL to ... where date>now() and date<date_sub(now(), interval 365 day) ... if date is in datetime format If in unixtime format, convert to unixtime for those functions ... where date>unix_timestamp() and date<(unix_timestamp()-(365*86400)) ... Documentation: http://mysql.com/date_sub (should redirect to http://www.mysql.com/doc/en/Date_and_time_functions.html) --------------------------------------------------------------------------- Peter Beckman Internet Guy beckman@purplecow.com http://www.purplecow.com/ ---------------------------------------------------------------------------

« previous php.db (#32949) next »