User Tools

Site Tools


doc:appunti:prog:timezone_php_python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
doc:appunti:prog:timezone_php_python [2017/02/09 11:25] – created niccolodoc:appunti:prog:timezone_php_python [2017/02/09 12:55] (current) – [Timestamp con ora solare/legale] niccolo
Line 1: Line 1:
 ====== Gestione delle timezone in Python e PHP ====== ====== Gestione delle timezone in Python e PHP ======
 +
 +===== La timezone del PHP =====
  
 Per verificare qual'è l'idea che ha il PHP della propria timezone si può eseguire il seguente codice: Per verificare qual'è l'idea che ha il PHP della propria timezone si può eseguire il seguente codice:
Line 14: Line 16:
 date.timezone = "Europe/Rome" date.timezone = "Europe/Rome"
 </file> </file>
 +
 +===== Pacchetto Debian python-tz =====
 +
 +Contiene un database delle timezone. Consente di istanziare oggetti di tipo **tzinfo**, ad esempio **''pytz.utc''** oppure **''pytz.timezone('CET')''**.
 +
 +==== Timestamp con ora solare/legale ====
 +
 +Nella tabella che segue ogni **timestamp** (calcolato come distanza dallo **Unix epoch** del 1970-01-01 00:00:00 UTC) è distante dal successivo **86400** secondi, cioè un giorno intero. La rappresentazione in orario locale (CET) mostra che è intervenuto il cambio da ora solare ad ora legale:
 +
 +^ Ora locale                ^ Timestamp    UTC  ^
 +| 2015-03-28 01:00:00 CET    1427500800 | 2015-03-28T00:00:00Z  |
 +| 2015-03-29 01:00:00 CET    1427587200 | 2015-03-29T00:00:00Z  |
 +| 2015-03-30 02:00:00 CEST  |  1427673600 | 2015-03-30T00:00:00Z  |
 +| 2015-03-31 02:00:00 CEST  |  1427760000 | 2015-03-31T00:00:00Z  |
doc/appunti/prog/timezone_php_python.1486635903.txt.gz · Last modified: 2017/02/09 11:25 by niccolo