DateTimePlugin

Esse plugin recebeu algumas melhoras e cortes. Pegue-o em TWiki:Plugins.DateTimePlugin .

EnglishPortuguês
This plugin is an extension of %GMTIME{"format"}% TWiki variable? that allows free date formating (with extra options), internacionalization and a relative time shift.

Didn't got it? DateTimePlugin permit you write:
next 5 days will be: %DATETIME{incdays="5"}%.
and you'll have an ever consitent statement.

This plugin has born because a demand to do search in a relative past, but I believe that other people may use it on many other cases.

Esse plugin é uma extensão da variável TWiki? %GMTIME{"format"}% que permite apresentar datas e horas com formatação livre (com opções extras), Internacionalização e com um deslocamento de tempo relativo.

Não entendeu? Com DateTimePlugin você pode escrever:
Daqui a 5 dias será: %DATETIME{incdays="5"}%.
e terá uma frase sempre coerente.

Esse plugin nasceu por necessidade de se fazer buscas com datas no passado relativo, mas acredito que outras pessoas poderão usa-lo para vários outros casos.


Syntax Rules

Parameters
Parameter:Description:Descrição:
"format" It defines as the date and hour will be represented. Define como a data e hora será representada.
format="format" The same as before. (ok?) O memo que o anterior.
date="a date" It indicates the date base to be formatted and added to a positive number of days (future) or negative (past). If this value is not defined, then the value it the date and current hour.

(Not implemented yet)

The input can be in the paterns:

Indica a data base para ser formatada e incrementada. Se não definido o valor é a data e hora atual.

(Não implementado ainda)

A entrada pode ser nos padrões:

  • TWiki: 2 Jul 1823
  • TWiki with hora: 2 Jul 1823 - 14:15:32 (the seconds and the hyphen are optional)
  • Unix integer Timestamp: 1044147759
  • ISO Timestamp: 1823-07-02T14:15Z
  • RCS Timestamp: 1823/07/02 14:15:32
incyears="#" Increases year. Incremententa o ano.
incmonths="#" Increases month. Incremententa o mês.
incdays="#" Increases day. Incremententa o dia.
inchours="#" Increases hour. Incremententa a hora.
incmins="#" Increases minutes. Incremententa os minutos.
incsecs="#" Increases seconds. Incremententa os segundos.
(# is an integer value, and can be negative)

Formating Variables
Variable:Expanded to:Convertida para: Example:
$day day of month, blank padded (1..31) O dia do mês. 2
$day2 day of month ( 01..31) O dia do mês com dois digitos. 02
$mo month (01..12) O número do mês com dois digitos. 07
$month abbreviated month name (Jan..Dec) O nome resumido do mês em inglês. Jul
$i_month locale's abbreviated month name (Jan..Dec) O nome resumido do mês internacionalizado. Jul
$lmonth full month name, variable length (January..December) O nome extenso do mês em inglês. July
$i_lmonth locale´s full month name, variable length (January..December) O nome extenso do mês internacionalizado. Julho
$year The 4 digit year. O ano em 4 digitos. 1823
$ye The 2 digit year. (Care with the century...) O ano em 2 digitos. (Cuidado com o século...) 23
$century The Century number. (Not implemented yet) O número do século. (Não implentado ainda) 19
$romancentury The Roman Century number. (Not implemented yet) O número do século em romanos. (Não implentado ainda) IX
$wday abbreviated weekday name (Sun..Sat) O nome resumido do dia da semana em inglês. Wed
$i_wday locale´s abbreviated weekday name (Sun..Sat) O nome resumido do dia da semana internacionalizado. Qua
$lwday full weekday name, variable length (Sunday..Saturday) O nome extenso do dia da semana em inglês. Wednesday
$i_lwday locale´s full weekday name, variable length (Sunday..Saturday) O nome extenso do dia da semana internacionalizado. Quarta-feira
$yday day of year (001..366) O dia do ano. 183
$hours
or $hour
hour (00..23) A hora em 2 digitos 14
$minutes
or $min
minute (00..59) Os minutos em 2 digitos 15
$seconds
or $sec
second (00..60) Os segundos em 2 digitos 32
$iso Predefined format, Timestamp ISO
$year-$mo-${day2}T$hour:${min}Z
Formato predefinido, ISO Timestamp
$year-$mo-${day2}T$hour:${min}Z
1823-07-02T14:15:32Z
$rcs Predefined format, Timestamp ISO
$year/$mo/$day2 $hour:$min:$sec
Formato predefinido, RCS Timestamp
$year/$mo/$day2 $hour:$min:$sec
1823/07/02 14:15:32
(The examples are to the date 2 Jul 1823 - 14:15:32 and the i18n is to portuguese)

Examples

Yesterday was %DATETIME{"$day $month $year" incdays="-1"}%. -> Yesterday was %DATETIME{"$lwday, $day $month $year" incdays="-1"}%.

(Baianês) De hoje a oito será %DATETIME{"$day de $i_lmonth" incdays="7"}%. -> De hoje a oito será %DATETIME{"$day de $i_lmonth" incdays="7"}%.

Using ShortHand and Variables:

%DATETIME{"What [[IGonnaDoIn$year$mo$day2][I gonna do tomorrow]]... %BR% $lwday, $day $lmonth." incdays="1"}% ->
%DATETIME{"What I gonna do tomorrow?...
$lwday, $day $lmonth." incdays="1"}%

Must be some thing like this:
What I gonna do tomorrow?...
Wednesday, 28 July.

  • Steps:
    1. Expand variables finded on format string;
    2. Expand format date variables;
    3. Convert ShortHand notation.

All the variables for now:

    %DATETIME{"
    • day: $day
    • day2: $day2
    • mo: $mo
    • month: $month
    • i_month: $i_month
    • lmonth: $lmonth
    • i_lmonth: $i_lmonth
    • year: $year
    • ye: $ye
    • century: $century
    • romancentury: $romancentury
    • wday: $wday
    • i_wday: $i_wday
    • lwday: $lwday
    • i_lwday: $i_lwday
    • yday: $yday
    • hours: $hours
    • minutes: $minutes
    • seconds: *$seconds*"}%

    DateTimePlugin Global Settings

    EnglishPortuguês
    Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, for example, %INTERWIKIPLUGIN_SHORTDESCRIPTION%.

    For the internacionalization, insert the names of the months and weekdays separated by one white space.

    Configurações de plugins são guardadas como variáveis de preferências. Para referênciar uma configuração de plugin escreva %<plugin>_<configuração>%, por examplo, %INTERWIKIPLUGIN_SHORTDESCRIPTION%.

    Para a internacionalização, insira os nomes dos meses e dias da semana separados por um espaço em branco.

    • The Internacionalization Setings:
      • Set monthLongNames = Janeiro Fevereiro Março Abril Maio Junho Julho Agosto Setembro Outubro Novembro Dezembro
      • Set monthShortNames = Jan Fev Mar Abr Mai Jun Jul Ago Set Out Nov Dez
      • Set weekdayLongNames = Domingo Segunda-feira Terça-feira Quarta-feira Quinta-feira Sexta-feira Sabado
      • Set weekdayShortNames = Dom Seg Ter Qua Qui Sex Sab

    • Localize my clock:
      • Set myGreenwich = -3

    • One line description, shown in the TextFormattingRules? topic:
      • Set SHORTDESCRIPTION = Extends the %GMTIME{"format"}% variable with more options and internationalization suport.

    • Set DEBUG to 1 to get debug messages in data/debug.txt. Default: 0
      • Set DEBUG = 1

    ToDo

    EnglishPortugês
    The ToDo list for the estable 1.0 version:
    • ...
    A lista de a-fazeres para a versão 1.0 estável:
    1. Corrigir o dia da semana quando o mês e/ou o ano é incrementado. ALERT!
    2. Implementar a variável de formatação $roman ALERT!
    3. Implementar a variável de formatação $romancentury ALERT!
    4. Inplementar a entrada de Data. ( efetivar o agumento date="a date" ) ALERT!

    Plugin Installation Instructions

    EnglishPortuguês
    • Download the ZIP file from the Plugin web (see below)
    • Unzip DateTimePlugin.zip in your twiki installation directory.
      Contents:
      File: Description:
      data/TWiki/DateTimePlugin.txt Plugin topic
      lib/TWiki/Plugins/DateTimePlugin.pm Plugin Perl module
    • Test if the plugin is correctly installed: you should see rendered dates on the example session.
    • Baixe o arquivo ZIP da web Plugin (veja abaixo)
    • Descompacte DateTimePlugin.zip no seu diretório de instalação do twiki.
      Conteudo:
      Arquivo: Descrição:
      data/TWiki/DateTimePlugin.txt Tópico do plugin
      lib/TWiki/Plugins/DateTimePlugin.pm Modulo Perl do plugin
    • Teste se o plugin está corretamente instalado. Você deverá ver datas renderizadas na sessão de exemplos.

    Plugin Info

    Plugin Author: TWiki:Main.AurelioAHeckert
    Plugin Version: 27 Jul 2004 (V0.90)
    CPAN Dependencies: none
    Other Dependencies: none
    Perl Version: 5.000
    Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/DateTimePlugin
    Feedback: http://TWiki.org/cgi-bin/view/Plugins/DateTimePluginDev

    -- AurelioAHeckert - 27 Jul 2004
    -- MauricioVieira - 30 Jul 2004

Topic revision: r5 - 30 Mar 2005 - 21:59:28 - AurelioAHeckert
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Wiki-SL? Send feedback