Re: newbie question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx                             http://www.purplecow.com/
---------------------------------------------------------------------------

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux