[ciapug] I hate dates...

Barry Von Ahsen ciapug@cialug.org
Sat, 29 Jan 2005 18:33:15 -0600


Chris Hettinger wrote:
> I need a reliable function that I can pass a MySQL time stamp like 
> (1978-07-03 00:00:00) and have it return to me only the date portion ...
> 
> I wrote something that just splits the datestamp, ignores the time 
> portion and make a new date with the year, month, and day. I am however 
> getting some returning incorrect.
> 
> Passed this: 1947-08-30 00:00:00
> Got this: 1969-12-31
> 
> I know there must be something wrong and I know that 1969 date indicates 
> that but I don't know what to do and it's been a really LONG week...
> 
> Can anyone do a little hand-holding for a moment :-\
> 

try date("Y-m-d", strtotime($mysql_date_time));

-barry