Reply to Re: How to format at date field output

Your name:

Reply:


Posted by Alvaro G. Vicario on 07/25/06 18:20

*** Bob Sanderson escribió/wrote (Tue, 25 Jul 2006 12:49:17 GMT):
> I have a field in a database called DateRcvd. At present, it outputs in my
> report in the yyyy-mm-dd format. I would like it to display in the dd/mm/yy
> format. What is the easiest way to accomplish this?

I particularly find it easier to handle dates as Unix timestamps. You don't
say what your DBMS is so I'll assume MySQL:

SELECT UNIX_TIMESTAMP(DateRcvd) FROM table

Once you read the value into a PHP variable, you can use almost date
function to format it, such as date() or strftime().

When you need to insert dates into MySQL:

INSERT INTO table (DateRcvd) VALUES (FROM_UNIXTIME(1153851613))


--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--

[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

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