voglio analizzare l'API created_at
valore di Twitter (memorizzato in una variabile), che assomiglia a questo:analisi del Twitter API created_at
Sun Aug 28 19:31:16 +0000 2011
In questa:
19:31, Aug 28
Ma ne ho bisogno essere consapevole del fuso orario. Qualche idea su come farlo usando php
?
Dopo aver usato la seconda opzione, che John Flatness suggerito sto ottenendo questo errore:
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() [<a href='datetime.--construct'>datetime.--construct</a>]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRT/-3.0/no DST' instead' in /misc.php:4
Stack trace:
#0 /misc.php(4): DateTime->__construct('Sun Aug 28 19:3...')
#1 /tabs/home.php(29): format_date(Object(SimpleXMLElement), 'America/Sao_Pau...')
#2 {main}
thrown in /misc.php on line 4
È possibile passare il fuso orario come secondo argomento al costruttore 'DateTime' per evitare tale errore (o impostare l'impostazione date.timezone in php.ini o utilizzare' date_default_timezone_set' per impostare in modo esplicito un fuso orario predefinito). –