2011-10-09 38 views
1

從這個數組中,我需要根據GMT + 1的日期和時間。第一個問題是如何從標題數組中獲得'日期'。其次,我如何格式化爲2011-10-09 08:40(這是格式,GMT + 1時間)。從頭部請求獲取最後更新日期和時間

Array ([headers] => Array ([Date] => Sun, 09 Oct 2011 07:40:10 GMT [Server] => Apache [Last-Modified] => Sun, 09 Oct 2011 07:39:29 GMT [ETag] => "10c8000a" [Accept-Ranges] => bytes [Content-Length] => 198311 [Content-Type] => image/jpeg) [info] => Array ([url] => http://domain.no/webcamera/broadcast.jpg [content_type] => image/jpeg [http_code] => 200 [header_size] => 208 [request_size] => 214 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.208861 [namelookup_time] => 0.003067 [connect_time] => 0.025592 [pretransfer_time] => 0.0256 [size_upload] => 0 [size_download] => 198311 [speed_download] => 949487 [speed_upload] => 0 [download_content_length] => 198311 [upload_content_length] => 0 [starttransfer_time] => 0.049787 [redirect_time] => 0 [certinfo] => Array ()) [curl_handle] => Resource id #2) 

回答

1

第一,得到的日期,你將有你做這樣的事情:

我假設數組變量$餡餅

$pie['headers']['Date'] 

創建日期時間對象,請參見this。並格式化日期,see