tt_news

1.7.7. Date and Time formats

The display of date and time values in the FrontEnd depends on the environment where TYPO3 is installed. tt_news uses the global language-settings from PHP and then it formats the date and time values with the stdWrap function "strftime". (see: http://www.php.net/manual/en/function.strftime.php )

The defaults for formating of the date and time strings are configured in the TS-setup of tt_news.

Notice: if you have one of the ts_language_xx extensions installed and configured as default language, these extension will override the default settings for the tt_news time formating. The language specific TS settings for several extensions can be found in the file "ext_typoscript_setup.txt" in the (ts_language-) extensions install directory (e.g. "typo3/ext/ts_language_de/ext_typoscript_setup.txt" for the german settings).     

 


These settings are again overridden by settings you make in your main TS template or in some "+ext" templates located in  pages below the main template. If you look in the "template analyzer" you see the loading order of the TS-settings. The values in the template at the end of the list will override previous settings):   

 


To view or change the settings for a page, click on "Template" in the "Web" menu, choose this page in the pagetree, and open the "TypoScript Object Browser" on this page. (See screenshot at the beginning of the section "Configuration").

Examples:
  1. Your site is a "one-language-site"  and you configured the site-language as default language of TYPO3. If you have a ts_language_xx extension installed, to set some country specific settings for other extensions, I suggest to copy the part which refers to tt_news in your main template or an ext template which is included. Here an example for german settings:

  # set the TYPO3 language to german
  config.language = de
  # set the PHP locale to german
  config.locale_all = de_DE

  # tt_news date & time formats
  plugin.tt_news {
    archiveTitleCObject {
      10.strftime = %B - %Y
    }
    getRelatedCObject {
        20.strftime = %d.%m.%Y %H:%M
    }
    displaySingle {
      date_stdWrap.strftime= %d.%m.%y
      time_stdWrap.strftime= %H:%M
    }
    displayLatest {
      date_stdWrap.strftime= %d.%m.%y
      time_stdWrap.strftime= %H:%M
    }
    displayList {
      date_stdWrap.strftime= %A %d. %B %Y
      time_stdWrap.strftime= %d.%m.%y %H:%M
    }
  }

Hint: If the locale_all setting "de_DE" don't work on your WAMP installation, try to set it to "german". There are some differences in the handling of the php-locale on windows and linux.  

 

  1. If your site is a multilanguage site like the "one-tree-fits-all-languages" example from the "testsite" package (see: http://typo3.org/documentation/tips-tricks/multi-language-sites-in-typo3/ ) you can add the country specific settings to the language condition in your TS-setup:

  # Setting up the language variable "L" to be passed along with links
  config.linkVars = L

  # German language, sys_language.uid = 2
  [globalVar = GP:L = 2]
  config.sys_language_uid = 2
  config.language = de
  config.locale_all = de_DE

  # set german date & time formats
  plugin.tt_news {
    archiveTitleCObject {
      10.strftime = %B - %Y
    }
    getRelatedCObject {
        20.strftime = %d.%m.%Y %H:%M
    }
    displaySingle {
      date_stdWrap.strftime= %d.%m.%y
      time_stdWrap.strftime= %H:%M
      age_stdWrap.age =  Minuten | Stunden | Tage | Jahre
    }
    displayLatest {
      date_stdWrap.strftime= %d.%m.%y
      time_stdWrap.strftime= %H:%M
    }
    displayList {
      date_stdWrap.strftime= %A %d. %B %Y
      time_stdWrap.strftime= %d.%m.%y %H:%M
    }
  }
  [global]

  # Danish language, sys_language.uid = 1
  [globalVar = GP:L = 1]
  config.sys_language_uid = 1
  config.language = dk
  config.locale_all = danish

  # set danish date & time formats
  plugin.tt_news {
    # sorry, don't know the danish date & time settings ;-)
  }
  [global]

To top


Valid XHTML 1.0!