You are here: Re: FormatDateTime Revisited « PHP Programming Language « IT news, forums, messages
Re: FormatDateTime Revisited

Posted by Adam Plocher on 09/27/40 11:37

PHP has some great date functions for formatting dates however you
could possibly want. First take a look at www.php.net/date for a list
of formats.

Notice that the second (optional) parameter to the date function is a
timestamp parameter. You must convert your date/time into a unix
timestamp but this can easily be achieved with the strtotime() function
(www.php.net/strtotime).

So basically you would want to do:

echo date("Y-m-d H:i:s", strtotime("December 25, 2005 11:55 PM"));
// this should return 2005-12-25 23:55:00 - this is the format I
usually use when inserting into MySQL

Note that strtotime should be able to take in just about ANY format of
date and time.

 

Navigation:

[Reply to this 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

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