date format in other languages

chris.gr - February 28, 2007 - 15:39
Project:Table Manager
Version:4.7.x-1.x-dev
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

It would be nice to have a field that allows to set the date format in other languages than English.

#1

pobster - February 28, 2007 - 17:09

Yeah s'easy enough; change this line in tablemanager_display;

            case "3": // Date
              $exp = explode('/', $a);
              $temp[] = array('data' => '<!-- '.$a.' -->'.date(variable_get('tablemanager_date_format', 'jS F Y'), mktime(0, 0, 0, $exp['1'], $exp['2'], $exp['0'])));
              break;

To;

            case "3": // Date
              $exp = explode('/', $a);
              setlocale(LC_TIME, "de_DE"); // German
              $temp[] = array('data' => '<!-- '.$a.' -->'.strftime(variable_get('tablemanager_date_format', 'jS F Y'), mktime(0, 0, 0, $exp['1'], $exp['2'], $exp['0'])));
              break;

You'll need to set the date format (on your settings page, NOT in the code here) to something from here; http://www.php.net/manual/en/function.strftime.php

(for an example try "%A %d %B %Y" which will output for instance, Friday 22 December 1978 in whatever language you've set the locale to).

Let me know if this works as it should as I can't test it on my server (functionality not installed...)

Pobster

#2

chris.gr - March 1, 2007 - 09:47

Thanks a lot, it worked. I added
setlocale(LC_TIME, "de_DE.UTF8"); // German
and set the date format according to your link.

#3

pobster - August 25, 2009 - 17:37
Status:active» fixed

#4

pobster - August 25, 2009 - 17:37
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.