Aiuto:ParserFunctions: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
→‎Collegamenti esterni: + collegamento a meta
imported>Brodo
m + →‎time: Tradotto da meta:ParserFunctions (da finire)
Riga 176:
* [http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/ParserFunctions/ ParserFunctions in MediaWiki SVN]
FINE TESTO COMMENTATO -->
== time ==
{{T sezione|lingua=inglese|argomento=|data=ottobre 2006}}
La funzione <tt>time</tt> è un costrutto per la formattazione del tempo. Sintassi:
 
<nowiki>{{</nowiki> #time: ''format'' <nowiki>}}</nowiki>
 
o
 
<nowiki>{{</nowiki> #time: ''format'' | ''time'' <nowiki>}}</nowiki>
 
If the time is not specified, the time at which the article is converted to HTML is used. Note that due to caching, this may be up to a week different to the time at which the article is viewed. Manual updates may be required, this can be achieved by saving the page without making any changes (a "null edit") or viewed with <code>action=purge</code> in search string of URL or viewed by a user whose option is "Disable page caching".
 
The ''format'' parameter is a format string similar to the one used by [http://www.php.net/date PHP's date].
 
The following format codes have the same meaning as in PHP. Significant differences from PHP's behaviour, apart from internationalisation (i.e. language and locale differences), should be considered an error of ParserFunctions and should be reported. All numeric format codes return numbers formatted according to the local language, use the xn code described below to override this.
 
{| cellpadding="6px" border=1 style="border:1px solid #C0C0C0; border-collapse:collapse;"
! Parametro
! Descrizione
! Esempio
|--------------
| d
| Il giorno del mese, con lo zero davanti.
| {{#time:d}}
|--------------
| D
| Abbrevazione del mese della settimana
| {{#time:D}}
|--------------
| j
| Il giorno del mese, senza lo zero davanti.
| {{#time:j}}
|--------------
| l
| Il giorno della settimana
| {{#time:l}}
|--------------
| N
| Il giorno settimanale nel formato [[ISO 8601]] (1 (per Lunedì) - 7 (per Domenica))
| {{#time:N}}
|--------------
| w
| Il giorno settimanale (0 (per Domenica) - 6 (per Sabato))
| {{#time:N}}
|--------------
| z
| Il giorno annuale (Partendo da 0 fino a 365)
| {{#time:z}}
|--------------
| W
| Numero della settimana in formato [[ISO 8601]]
| {{#time:W}}
|--------------
| F
| Il nome completo del mese
| {{#time:F}}
|--------------
| m
| Il numero del mese, con lo zero davanti.
| {{#time:m}}
|--------------
| M
| Abbrevazione del mese
| {{#time:M}}
|--------------
| n
| Il numero del mese, senza lo zero davanti.
| {{#time:n}}
|--------------
| t
| Numero di giorni del mese
| {{#time:t}}
|--------------
| L
| 1 se l'anno è bisestile, 0 altrimenti
| {{#time:L}}
|--------------
| Y
| Anno in 4 cifre
| {{#time:Y}}
|--------------
| y
| Anno in 2 cifre
| {{#time:y}}
|--------------
| a
| am o pm
| {{#time:a}}
|--------------
| A
| AM o PM
| {{#time:A}}
|--------------
| g
| L'ora in formato 12 ore, senza lo zero davanti (1 - 12)
| {{#time:g}}
|--------------
| G
| L'ora in formato 24 ore, senza lo zero davanti (0 - 23)
| {{#time:G}}
|--------------
| h
| L'ora in formato 12 ore, con lo zero davanti (01 - 12)
| {{#time:h}}
|--------------
| H
| L'ora in formato 24 ore, con lo zero davanti (00 - 23)
| {{#time:H}}
|--------------
| i
| Il minuto (00 - 59)
| {{#time:i}}
|--------------
| s
| Il secondo (00 - 59)
| {{#time:s}}
|--------------
| c
| La data in formato [[ISO 8601]]
| {{#time:c}}
|--------------
| r
| La data in formato [[RFC 2822]]
| {{#time:r}}
|--------------
| U
| Secondi dal Gennaio 1 1970 00:00:00 GMT
| {{#time:U}}
|}
 
The following format codes are extensions to the PHP syntax:
 
{| cellpadding="6px" border=1 style="border:1px solid #C0C0C0; border-collapse:collapse;"
! Code
! Description
|--------------
| xn
| Format the next numeric code as a raw ASCII number. For example, in the Hindi language, {&#123; #time:H, xnH}} produces {{ #time:H, xnH}}.
|--------------
| xN
| Toggle a permanent raw number formatting flag. Like xn, except it lasts until the end of the string or until the same code appears again.
|--------------
| xr
| Formato che trasforma dal formato numerico al codice romano. Lavora solo con numeri fino a 3000. <!--(Esempio <nowiki>{{</nowiki>#time:xrY/xrY/xrY|1/1/1827<nowiki>}}</nowiki> ritorna {{ #time:xrY/xrY/xrY|1/1/1827}} )-->
|--------------
| xg
| Output the genitive form of the month name, for languages which make such a distinction between genitive and nominative.
|--------------
| xx
| A literal "x"
|}
 
Any unrecognised character will be passed through to the output unmodified. There are also two quoting conventions which can be used to output literal characters.
 
* Characters enclosed in double quotes will be considered literal (with the quotes themselves removed). Unmatched quotes will be considered literal quotes. Example:
** {&#123; #time: "The month is" F}} &rarr; The month is January
** {&#123; #time:i's"}} &rarr; 20'11"
* Backslash escaping as in PHP's date() is supported. \H produces a literal H, \" produces a literal ".
 
More format codes may be added in the future, as demanded by the users of this extension. This may come in the form of either a more complete implementation of PHP's format codes, or additional "x" codes.
 
The format of the ''time'' parameter is identical to the one used by PHP's strtotime(). It supports both absolute and relative dates, such as "December 11" and/or "+10 hours", which can be used for timezone translation. Please see [http://www.gnu.org/software/tar/manual/html_node/tar_109.html the GNU tar manual] for more information.
 
==== Esempi ====
*<nowiki>{{#time:j F Y|-14 days}}</nowiki> ritorna {{#time:j F Y|-14 days}} (14 giorni fa)
*<nowiki>{{#time:H:i|+6 hours}}</nowiki> ritorna {{#time:H:i|+6 hours}} (6 ore meno [[UTC]])
*<nowiki>{{#time:H:i|8:15 +6 hours}}</nowiki> ritorna {{#time:H:i|8:15 +6 hours}}
*<nowiki>{{#time:m/Y|-1 months}}</nowiki>ritorna {{#time:m/Y|-1 months}} (1 mese fa)
 
====Periodo====
Il period di funizionamento corretto di questa funzione si estende dal 1970-1-1 00:00:01 fino al 2038-1-19 03:14:07 (1 through <math>2^{31}</math> 1 secondi dopo l'inizio del 1970). Vedi anche [[:en:Year 2038 problem]].
 
== Collegamenti esterni ==
* {{en}} [[m:ParserFunctions|La pagina completa su meta]]