Welcome Guest, Not a member yet? Register   Sign In
CI locale problem
#1

[eluser]MVUG[/eluser]
Hi guys,

I've got a problem with my CI 1.7.2... I use the date helper to format a date (mdate() function), but is gets formatted in English notation.
When I do setlocale(LC_TIME, 'nl_NL'); in my code it still isn't formatted right (in a view), but when I do this (in a controller or view), it works:

Code:
/* Set locale to Dutch */
setlocale(LC_ALL, 'nl_NL');

/* Output: vrijdag 22 december 1978 */
echo strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 22, 1978));

it works...

Can anybody help? Is there a specific place to put the setlocale?
#2

[eluser]n0xie[/eluser]
If you put it in your index.php does that help?
#3

[eluser]WanWizard[/eluser]
mdate is a function to generate a MYSQL date, it doesn't do anything with a locale, it just returns the date in the format you use as parameter.
#4

[eluser]MVUG[/eluser]
mmm I think I've found the problem...

setlocale doesn't seem to work with date() function, but with strftime() is works...




Theme © iAndrew 2016 - Forum software by © MyBB