Forums

This topic is locked

date format php/mysql

Posted 22 years ago
1
has voted
22 years ago Henk Arends posted:
Maybe a simple question, but please help.

I have a date field in my database. In stead of the US notation (yyyy/mm/dd), I want the output on my webpage as dd/mm/yyyy.

The MX code is: <?php echo $row_rsRecordset['date']; ?>.

Thanks,
HJA

Replies

Replied 22 years ago
22 years ago Brent Colflesh replied:
Dear Hja,
Take a look:

www.php.net/manual/en/function.date.php

Regards,
Brent

Replied 22 years ago
22 years ago Henk Arends replied:
Thanks Brent, found it the solution, but came to a new problem... <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>.

When I select from my database (SELECT DATE_FORMAT(datum,'%W, %d %M %Y') AS
dat), I get the output in English (for instance Wednesday, 04 December
2002).

How do I translate this into Dutch? I've tried several things from
www.mysql.com an www.php.net, tried to find the answer through Google, but I
can't find the answer (or better, don't know how to make it work).

Please help!

HJA
Replied 22 years ago
22 years ago Brent Colflesh replied:
Dear Hja,
I have not tried this - let me know if it works:

www.faqts.com/knowledge_base/view.phtml/aid/389/fid/18

Regards,
Brent

Replied 22 years ago
22 years ago Henk Arends replied:
Brent,

It didn't work, but I finaly succeded!

First I changed the SELECT statement in SELECT UNIX_TIMESTAMP(date) AS date, making the date field a unix timestamp.

In the body I used the following code:

&lt;?php
setlocale (LC_ALL, 'nl_NL');
$timestamp = $row_rsActiviteiten['datum'];
echo strftime( "%A %d %B %Y",$timestamp);
?&gt;

Wich gave me the result I wanted.

Thanks for your help!

HJ

Reply to this topic