Date in Dutch

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
leon
Posts: 3
Joined: Sat Mar 25, 2006 11:41 pm

Date in Dutch

Post by leon »

Script URL: http://www.kerkwest.nl/gb/gbook.php
Version of script: 1.35
Version of PHP:
Hosting company:
Have you searched THIS FORUM for your problem: yes
(if not please do before posting)
If so, what terms did you try: date dutch

Write your message below:

Hi,

is it possible to change the english name of the month into the dutch name? I think I have to change $added somewhere???


Thnx and regards,
Leon
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

Hello Leon,

Yes it can be done.

It requires changing the gbook.php file at line 435

Code: Select all

$added=date ("F j, Y");
If the function setlocale is available on your hosting server you can edit the code to display local weekdays and months. Change the date code to this

Code: Select all

setlocale (LC_TIME, "Dutch");
$added=strftime ("%A %d %B %Y om %H:%M");
This is te code I use.
It is possible that you have to change setlocale (LC_TIME, "Dutch"); to setlocale (LC_TIME, "nl_NL"). I think it has to do with the OS of your host. I think with Windows you have to use "Dutch" and with Linux you have to use "nl_NL".

For information about the possible codes for the strftime function, look at this page
http://www.php.net/manual/en/function.strftime.php
or in dutch http://www.php.net/manual/nl/function.strftime.php

If the setlocale function is not supported on your hosting server you can change the date to use all numbers, for example

Code: Select all

$added=date ("d-m-Y");
Greetings,
Henrie
leon
Posts: 3
Joined: Sat Mar 25, 2006 11:41 pm

date in dutch

Post by leon »

Thanks Henrie,

this works! However, only for new entries and not for those which were posted before changing the script. (?)

Groeten / regards !
Leon
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

That's because the entry is generated when it is written and is stored in the entries.txt file when it is submitted.

The pages that are being shown in the guestbook are just a presentation of the data in the entries.txt file.
It's not like the dates are being stored as a general date and you can choose how it is presented on screen. The date is shown exactly as it is stored in the entries.txt file.

The dates already present can be changed by editing the entries.txt file directly in a plain text editor.

Greetings / de Groeten,
Henrie
leon
Posts: 3
Joined: Sat Mar 25, 2006 11:41 pm

Date in dutch

Post by leon »

Aha,

now I understand! Thnx Henrie ! :D
Post Reply