Re: convert date in german format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




how can I convert a date stored in a mysql-database for output
in the german format (dd.mm.yy).

I tried date ("d.m.y",$row->from);

the second parameter to date() should be a unix timestamp (integer). Did you convert your MySQL date to a timestamp?

Try:

date("d.m.y", strtotime($row->from));

if that doesn't work (strtotime will return -1 if it fails, which will end up looking like 31.12.69 when date() renders it), then you may need to either a) use MySQL's UNIX_TIMESTAMP() function in your query to convert your date to a unix timestamp or b) use preg_match() and mktime() to create the unix timestamp from the MYSQL data.

Hans

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux