sandy1028 Posted April 4, 2011 Share Posted April 4, 2011 99.60.97.205 - - [26/Mar/2011:06:10:00 +0000] GET /2009-03-29/world/impact.row.atlantic_1_rower-paul-ridley-cancer-research?_s=PM:WORLD HTTP/1.1 200 9386 www.abc.com Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13 TCP_MISS Apache=- - 1068000 - - - deflate=- rmt=- 72.234.67.132 - - [26/Mar/2011:09:40:14 +0000] GET /ad-abc.php?f=medium_rectangle HTTP/1.1 200 869 www.abc.com Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.16) Gecko/20101130 Firefox/3.5.16 TCP_HIT Apache=- - 1000 - - - deflate=- rmt=- 68.12.178.167 - - [26/Mar/2011:09:30:00 +0000] GET /ad-feedback.js.php?e3e999d9b79cf36c165f5b379a0e9f269be82344 HTTP/1.1 200 600 www.abc.com Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) TCP_HIT Apache=- - 1000 - - - deflate=- rmt=- 128.186.145.53 - - [26/Mar/2011:10:10:00 +0000] GET /ad-feedback.js.php?e3e999d9b79cf36c165f5b379a0e9f269be82344 HTTP/1.1 200 628 www.abc.com Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; MAAU; .NET4.0C) TCP_HIT Apache=- - 2000 - - - deflate=- rmt=- 174.253.212.250 - - [27/Mar/2011:05:32:00 +0000] GET /css/ap-CN1-G02.css?e3e999d9b79cf36c165f5b379a0e9f269be82344 HTTP/1.1 200 7146 www.abc.com Mozilla/5.0 (Linux; U; Android 2.2; en-us; ADR6300 Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 TCP_HIT Apache=- - 5000 - - - deflate=- rmt=- 99.60.97.205 - - [27/Mar/2011:04:56:00 +0000] GET /css/ap-CN2-G02.css?e3e999d9b79cf36c165f5b379a0e9f269be82344 HTTP/1.1 200 7125 www.abc.com Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13 TCP_HIT Apache=- - 2000 - - - deflate=- rmt=- 72.234.67.132 - - [27/Mar/2011:05:50:00 +0000] GET /css/ap-CN-G02-FN-01.css?9a7045bca32825fa0b5406740c4161bccd455ef2 HTTP/1.1 200 7049 www.abc.com Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.16) Gecko/20101130 Firefox/3.5.16 TCP_HIT Apache=- - 0 - - - deflate=- rmt=- 76.91.142.36 - - [27/Mar/2011:06:00:09 +0000] GET /css/ap-CN-G02-FN-01.css?e3e999d9b79cf36c165f5b379a0e9f269be82344 HTTP/1.1 200 41888 www.abc.com Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) TCP_HIT Apache=- - 27000 - - - deflate=- rmt=- 68.12.178.167 - - [27/Mar/2011:06:30:10 +0000] GET /favicon.ico HTTP/1.1 200 5873 www.abc.com Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) TCP_HIT Apache=- - 1000 - - - deflate=- rmt=- 128.186.145.53 - - [27/Mar/2011:09:00:00 +0000] GET /favicon.ico HTTP/1.1 200 5904 www.abc.com Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; MAAU; .NET4.0C) TCP_HIT Apache=- - 1000 - - - deflate=- rmt=- I have a tab delimited input file, how to convert timestamps (which is in column 4) to PST time. Current time stamp is in GMT. Link to comment https://forums.phpfreaks.com/topic/232625-gmt-to-pst/ Share on other sites More sharing options...
dcro2 Posted April 4, 2011 Share Posted April 4, 2011 Use date_default_timezone_set() to set your timezone to either static GMT-8 or a regional timezone (http://www.php.net/manual/en/timezones.america.php) so it changes when daylight savings comes. Then just feed the timestamp to date(strtotime()); date_default_timezone_set('Etc/GMT-8'); //choose one date_default_timezone_set('US/Pacific'); //choose one $timepattern = '/\[([\d]{2}\/[\w]{3}\/[\d]{4}:[\d]{2}:[\d]{2}:[\d]{2}[ ]+[\+\-][\d]{2}[\d]{2})\]/'; if(preg_match($timepattern, $logline, $matches)) { $timestamp = date("m/M/Y:H:i:s O", strtotime($matches[1])); $logline = preg_replace($timepattern, '['.$timestamp.']', $logline); } ... or something like that. Link to comment https://forums.phpfreaks.com/topic/232625-gmt-to-pst/#findComment-1196648 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.