arbitter Posted March 21, 2010 Share Posted March 21, 2010 I have a dutch site. For my pictures, I store them in directories made witht the date() function. (you can check here: http://www.fransdepypere.be/uploads/uploads.php) Now all the date() and stuff is in english. This is rather annoying because it's solely used for dutch purpose and dutch people. How do I change this? Do I have to contact my sitehost? Can you change this in 'DirectAdmin'? It's my first site, first webhostingexperience, so try to explain clear... Quote Link to comment https://forums.phpfreaks.com/topic/196048-change-language-setting-date/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 21, 2010 Share Posted March 21, 2010 To format dates in other languages, you should use the setlocale and strftime functions instead of date(). Quote Link to comment https://forums.phpfreaks.com/topic/196048-change-language-setting-date/#findComment-1029739 Share on other sites More sharing options...
arbitter Posted March 21, 2010 Author Share Posted March 21, 2010 Thanks a lot, I'll try that out, seems pretttty difficult to me though in the first example it's: setlocale(LC_ALL, 'nl_NL'); in the second, windows example, it's: setlocale(LC_ALL, 'nld_nld'); Quote Link to comment https://forums.phpfreaks.com/topic/196048-change-language-setting-date/#findComment-1029740 Share on other sites More sharing options...
arbitter Posted March 21, 2010 Author Share Posted March 21, 2010 Problem; the setlocale() works fine, but I get problems for example here: echo strftime("%A %e %B %C"); %A means the day in full %e means the day in numbers %B means the month in full %C means the year in 2 last numbers Yet when I echo it, I solely get the daty in full and the month in full... Quote Link to comment https://forums.phpfreaks.com/topic/196048-change-language-setting-date/#findComment-1029744 Share on other sites More sharing options...
oni-kun Posted March 21, 2010 Share Posted March 21, 2010 Thanks a lot, I'll try that out, seems pretttty difficult to me though in the first example it's: setlocale(LC_ALL, 'nl_NL'); in the second, windows example, it's: setlocale(LC_ALL, 'nld_nld'); If you are using a web hosting provider, You are most likely using a Linux based version of Apache (Most websites use CentOS or Fedora, Not many use Windows), so you'd naturally use: setlocale(LC_ALL, 'nl_NL'); echo strftime("%A"); //May say: Zondag You can look at the manual of strftime to create custom dates. Quote Link to comment https://forums.phpfreaks.com/topic/196048-change-language-setting-date/#findComment-1029746 Share on other sites More sharing options...
arbitter Posted March 24, 2010 Author Share Posted March 24, 2010 Problem is that not all my variables get through (as I dictated in my last post). Anyone any help on this? edit: my bad; isn't possible: Not all conversion specifiers may be supported by your C library, in which case they will not be supported by PHP's strftime(). Additionally, not all platforms support negative timestamps, so your date range may be limited to no earlier than the Unix epoch. This means that %e, %T, %R and, %D (and possibly others) - as well as dates prior to Jan 1, 1970 - will not work on Windows, some Linux distributions, and a few other operating systems. Quote Link to comment https://forums.phpfreaks.com/topic/196048-change-language-setting-date/#findComment-1030981 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.