Localized dates and times
- Sitestorm
- Newbie
- Posts: 2
- Joined: Tue Apr 08, 2014 11:41 pm
Localized dates and times
I'm translating the component to Dutch, but cannot find a way to localize the dates and times. Is this possible?
- Jack
- Advanced Member
- Posts: 668
- Joined: Fri Mar 27, 2009 7:37 pm
- Location: Australia
- Sitestorm
- Newbie
- Posts: 2
- Joined: Tue Apr 08, 2014 11:41 pm
Re: Localized dates and times
Excellent. Very elegant. For anyone finding this answer, these are my adjustments:
Add this method to your language file class (substitute your personal locale, this is for the Netherlands):
And the format strings (add these in the AdminCP -> Settings):
Add this method to your language file class (substitute your personal locale, this is for the Netherlands):
Code: Select all
public function date($format, $timestamp = null)
{
setlocale(LC_ALL, 'nl_NL');
$timestamp = strtotime($timestamp);
return strftime($format, $timestamp);
}
Code: Select all
Date/Time:
%H:%M %d/%m/%Y
Date:
%d/%m/%Y
Timeline Day:
%A, %e %B %Y
Timeline Time:
%H:%M
Last edited by Sitestorm on Wed Apr 09, 2014 5:49 pm, edited 1 time in total.
Who is online
Users browsing this forum: No registered users and 1 guest