Date format
Date format
Script URL:Latest
Version of script:1.6
Hosting company:Binero
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:Forum
Write your message below:
I have test to make the date in another language but i can´t get it to work. Have also read a post about this dated mars and there are still no answer to that.
So i just ask here if there are someone that can help me on this.
It look like this now
Tillagd: July 15, 2009
But i whant it in swedish like this
Tillagd: 15 Juli, 2009 kl. 18.44
Think this is hardcoded but it must go and changes some way...or?
Thanks
Jogge
Version of script:1.6
Hosting company:Binero
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:Forum
Write your message below:
I have test to make the date in another language but i can´t get it to work. Have also read a post about this dated mars and there are still no answer to that.
So i just ask here if there are someone that can help me on this.
It look like this now
Tillagd: July 15, 2009
But i whant it in swedish like this
Tillagd: 15 Juli, 2009 kl. 18.44
Think this is hardcoded but it must go and changes some way...or?
Thanks
Jogge
Hello Jogge.
I use this solution:
viewtopic.php?p=8447#8447
(and here the same solution, but described a little different, for version 1.35
viewtopic.php?p=3080#3080)
i think the setlocale string for swedish is setlocale(LC_TIME, "Swedish", "sv_SE"); i could not test te sv_SE part because i don't have a linux server with swedish locale installed. The Swedish part for windows servers works)
Or you can use this script (translate to swedish ofcourse):
viewtopic.php?p=10658#10658
Greetings,
Henrie
I use this solution:
viewtopic.php?p=8447#8447
(and here the same solution, but described a little different, for version 1.35
viewtopic.php?p=3080#3080)
i think the setlocale string for swedish is setlocale(LC_TIME, "Swedish", "sv_SE"); i could not test te sv_SE part because i don't have a linux server with swedish locale installed. The Swedish part for windows servers works)
Or you can use this script (translate to swedish ofcourse):
viewtopic.php?p=10658#10658
Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Hello Jogge,
For information about the possible codes for the strftime function, look at this page
http://www.php.net/manual/en/function.strftime.php
Unfortunately, i could not look if capitals are a part of it, because the site was unreachable just now.
Anyhow, I think the strings depend on the locale installed on the server.
Greetings,
Henrie
For information about the possible codes for the strftime function, look at this page
http://www.php.net/manual/en/function.strftime.php
Unfortunately, i could not look if capitals are a part of it, because the site was unreachable just now.
Anyhow, I think the strings depend on the locale installed on the server.
Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Date format
Hi again Henrie.
I shall check the site but as you say it´s down.
I let you now when i have found the solution
Thanks again
Jogge
I shall check the site but as you say it´s down.
I let you now when i have found the solution
Thanks again
Jogge
Date format
Hi again Henrie.
Think i stay with your first solution, can get it to work with big characters in day and mounth
Thanks
Jogge
Think i stay with your first solution, can get it to work with big characters in day and mounth
Thanks
Jogge
I see the php.net site can be reached now again.
And indeed, no alternative code for starting capitals. So it must be defined in the locale strings on the server.
If done correctly the first letter of days and months should be as definied in the grammatical rules of the country.
So when you say it starts with lower case letter this is the normal rule in Sweden. Offcourse this doesn't take in account the starting capital of a sentence.
Greetings,
Henrie
And indeed, no alternative code for starting capitals. So it must be defined in the locale strings on the server.
If done correctly the first letter of days and months should be as definied in the grammatical rules of the country.
So when you say it starts with lower case letter this is the normal rule in Sweden. Offcourse this doesn't take in account the starting capital of a sentence.
Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Date format Dutch
Hi,
I use latest version 1.7, were kan I change the date format.
I want to see in my gbook date - month - year.
I tried the format as above but nothing changes.
Language I use is Dutch.
Greetings
Toontjew
I use latest version 1.7, were kan I change the date format.
I want to see in my gbook date - month - year.
I tried the format as above but nothing changes.
Language I use is Dutch.
Greetings
Toontjew
Hello Toontjew,,
In the gbook.php (version 1.7) file find the following code (starting at line 875)
For displaying date like this: 29 december 2009, change it to
For displaying only numbers date like: 29-12-2009, change it to
Greetings,
Henrie
In the gbook.php (version 1.7) file find the following code (starting at line 875)
Code: Select all
$m = date('m');
if (isset($lang['m'.$m]))
{
$added = $lang['m'.$m] . date(" j, Y");
}
else
{
$added = date("F j, Y");
}
Code: Select all
$m = date('m');
if (isset($lang['m'.$m]))
{
$added = date(" j ") . $lang['m'.$m] . date(" Y");
}
else
{
$added = date("j-n-Y");
}
Code: Select all
{
$added = date("j-n-Y");
}
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Hello,
First post, I really appreciate the work done with Gbook.
Seems like the solution above has changed just a tad since the introduction of a separate language file.
The way I got this to work in 1.7 was to follow the instructions above but also to delete the "if"-statements with start on row 876 (as per the row numbering in the defaualt gbook.php 1.7).
For 1.7
Remove rows 876 to 882
and replace with
Modify "setlocale" and "strftime" to your own preferences.
Regards
PiPPi
Stockholm, Sweden
First post, I really appreciate the work done with Gbook.
Seems like the solution above has changed just a tad since the introduction of a separate language file.
The way I got this to work in 1.7 was to follow the instructions above but also to delete the "if"-statements with start on row 876 (as per the row numbering in the defaualt gbook.php 1.7).
For 1.7
Remove rows 876 to 882
Code: Select all
if (isset($lang['m'.$m]))
{
$added = $lang['m'.$m] . date(" j, Y");
}
else
{
$added = date("F j, Y");
Code: Select all
{
setlocale(LC_TIME, "sv_SE");
$added=strftime("%A %d %B %Y, %H:%M");
Regards
PiPPi
Stockholm, Sweden
The changed function was done to be not dependent on the strftime function which is not supported by all servers. Your solution depends also on the strftime function.
To get the same result with only the php date function you can do the following.
Open your language file language.inc.php (or in my case nederlands.inc.php) and add the following (example is in english, change it to your own language).
Than in the file gbook.php find line 878 (in version 1.7) and change it to something like This will output: Sunday 24 january 2010 at 13:01
Than in the file gbook.php find line 875 (in version 1.7) and insert directly below it This is inserted before line 876 which has the code if (isset($lang['m'.$m])
Now you have nationalised date string with day and time without using the strftime function.
To read more about the date function, use this link: http://www.php.net/manual/en/function.date.php
To get the same result with only the php date function you can do the following.
Open your language file language.inc.php (or in my case nederlands.inc.php) and add the following (example is in english, change it to your own language).
Code: Select all
$lang['w0']='Sunday';
$lang['w1']='Monday';
$lang['w2']='Tuesday';
$lang['w3']='Wednesday';
$lang['w4']='Thursday';
$lang['w5']='Friday';
$lang['w6']='Saturday';
Code: Select all
$added = $lang['m'.$m] . date(" j, Y");
Code: Select all
$added = $lang['w'.$w] . date(" j ") . $lang['m'.$m] . date(" Y") . " at " . date("G:i");
Than in the file gbook.php find line 875 (in version 1.7)
Code: Select all
$m = date('m');
Code: Select all
$w = date('w');
Now you have nationalised date string with day and time without using the strftime function.
To read more about the date function, use this link: http://www.php.net/manual/en/function.date.php
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Many thanks,
Nice clean code and not dependent on the server setup.
Just one more to go, viewtopic.php?p=12708#12708
Regards
PiPPi
Nice clean code and not dependent on the server setup.
Just one more to go, viewtopic.php?p=12708#12708

Regards
PiPPi
Re: Date format
I've followed the instructions for adding the time to the date and it's worked fine, except that the time is 5 hours behind my actual time. How do I tell it to use UK time? (My server is in the USA)
I'd like to say thanks for making this script available - the guestbook is a lot better and has more functionality than a lot of the others I looked at.
I'd like to say thanks for making this script available - the guestbook is a lot better and has more functionality than a lot of the others I looked at.
Re: Date format
Please take a look at the following topic viewtopic.php?f=3&t=2421pagallery wrote:I've followed the instructions for adding the time to the date and it's worked fine, except that the time is 5 hours behind my actual time. How do I tell it to use UK time? (My server is in the USA)
Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.