Reply to Re: More noob nonsense - output format for a timestamp date variable

Your name:

Reply:


Posted by Gordon Burditt on 04/26/06 08:55

>I have a variable - $lastdate - that is the latest date any record in a
>MySQL database was updated. Its MySQL format is TIMESTAMP.

I recommend using date_format() in MySQL.

>If I say [echo $lastdate] I get the output I'd expect - 20060424221549
>which is a YYYYMMDDHHMMSS format.
>
>I'd like to be able to display that using a format of mm/dd/yy with no

In case you haven't heard, years have 4 digits. Ever hear about
the Y2K problem?

>leading spaces on the month and day. I don't know what the php command
>is to do this. In other words, I'm trying to display a variable -
>$lastdate - formatted a certain way. I know that the formatting string
>n/j/y will get my output looking as I'd like, but I can't figure out how
>to apply that to my variable.

SELECT DATE_FORMAT(stamp, '%m/%d/%y'), ...
if you absolutely insist on writing non-Y2K-compliant code.

Gordon L. Burditt

[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

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