Page 1 of 1

How to change the name of days and months?

Posted: Thu Mar 19, 2009 11:45 am
by MicroBoy
How to change the name of days and months into my language, example from Monday to E Hënë etc... The function that I use is date();

Re: How to change the name of days and months?

Posted: Thu Mar 19, 2009 11:54 am
by John Cartwright
I'm not sure what language you are using, but you can use set the locale using (example is dutch)

Code: Select all

set_locale(LC_TIME, , 'nl_NL');

Re: How to change the name of days and months?

Posted: Thu Mar 19, 2009 11:56 am
by jayshields
You might just have to make arrays of whatever language you want to convert into and do it that way, unless there's something on http://www.php.net/manual/en/ref.calendar.php

Re: How to change the name of days and months?

Posted: Thu Mar 19, 2009 12:04 pm
by MicroBoy
My language is Albanian, usually it uses SQ prefix. Where I have to put:

Code: Select all

set_locale(LC_TIME, , 'nl_NL');
or that array? I use this for my date and time

Code: Select all

$time= date("l d F Y, H:i:s");
 
//then I insert it to DataBase by://
 
$sql="INSERT INTO lajmet (name, news, time)
 

Re: How to change the name of days and months?

Posted: Thu Mar 19, 2009 12:17 pm
by John Cartwright
You'll need to use strftime() to format the date per the locale settings. In your case, the format would be

Code: Select all

$time = strftime("%A %d %B %Y, %T");

Re: How to change the name of days and months?

Posted: Thu Mar 19, 2009 12:55 pm
by MicroBoy
When I Use Like this:

Code: Select all

setlocale(LC_ALL, 'nld_nld');
$time= strftime("%A %d %B %Y")
It works good, but when I try to add the time like you wrote:

Code: Select all

$time = strftime("%A %d %B %Y, %T");
It Does't show neither date or time.

Can you tell me where I can find the code that php uses for states because I don't know what I have to use for Albanian language.

Re: How to change the name of days and months?

Posted: Thu Mar 19, 2009 3:28 pm
by John Cartwright
Take a look at http://ca.php.net/manual/en/function.strftime.php, it seems not all the formats are supported on all platforms.

Re: How to change the name of days and months?

Posted: Fri Mar 20, 2009 6:07 am
by MicroBoy
Everything it's ok but my months and days now are in lowercase can I change that the first word would be in uppercase?

Re: How to change the name of days and months?

Posted: Fri Mar 20, 2009 8:22 am
by jayshields

Code: Select all

strtoupper()
?

Re: How to change the name of days and months?

Posted: Fri Mar 20, 2009 10:00 am
by phpfrq
putenv("TZ=ASIA/Dhaka"); // My timezone
$thedate=date("U"); //get unix timestamp
$displaytime=date("F j, Y, g:i a");

Re: How to change the name of days and months?

Posted: Sat Mar 21, 2009 7:01 am
by MicroBoy
jayshields wrote:

Code: Select all

strtoupper()
?
Thnx a lot, this is exactly what I want ucwords() I found in php.net while I was seeing for strtoupper().

Now I have another problem, my language has a letter that is "ë" but in web-page it shows me like a symbol, when I log in phpmyadmin I can see that there is ë but in WeBPage it doesn't show like ë, but like a symbol. I converted the .php file into "UTF-8 Without BOM" cause everytime this worked for me, but now for the date it doesn't work this thing.