Reply to Re: Formatting a date with php from a mysql table

Your name:

Reply:


Posted by mantrid on 10/28/07 13:27

thanks Micheal
I will do the formatting in the sql statement as you suggest
Ian


"Michael Fesser" <netizen@gmx.de> wrote in message
news:8d87i3tibgaks4upufavebq6co01611bje@4ax.com...
> .oO(mantrid)
>
> >ok
> >I found it
> >
> >echo date('d-m-Y', strtotime($selldatetime))
> >
> >seems to work
>
> It does, but often it makes more sense to let MySQL return an already
> formatted date. Have a look at the DATE_FORMAT() function.
>
> The main reason is that it avoids the conversion of the date to a Unix
> timestamp. These timestamps are much more restricted in range (typically
> 1970-2038, back to 1902 with negative values) than MySQL timestamps and
> should be avoided when they're not really necessary like in this case.
>
> And just in case your script still has to work with Unix timestamps, the
> DB can also do this conversion work for you with UNIX_TIMESTAMP(). I
> would prefer that instead of a strtotime() call.
>
> Micha

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация