Kees Sonnema
Kees Sonnema

Reputation: 5784

How do I format a timestamp field from database to dutch locale?

I'm trying to format this timestamp string from database to a dutch locale that looks something like this:

Maandag 2 juli 2013

I tried this:

<?php setlocale(LC_ALL, 'nl_NL'); echo strftime("%A %e %B %Y", mktime($vac->geplaatstop)); ?>

Where $vac->geplaatstop; is my field from the database. I used a timestamp field for this.

I tried this to see if it worked anyway.

<?php setlocale(LC_ALL, 'nl_NL'); echo strftime("%A %e %B %Y"); ?>

That gives the right format, for today. but I want the time from the database.

How could I do this?

Upvotes: 0

Views: 112

Answers (1)

silkfire
silkfire

Reputation: 26033

Try this:

setlocale(LC_ALL, 'nl_NL');
echo strftime('%A %e %B %Y', strtotime($vac->geplaatstop));

The function mktime()'s arguments are different time elements, see the documentation here:

mktime() - http://php.net/manual/en/function.mktime.php

Upvotes: 2

Related Questions