Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Can't parse timezone minute offsets #19

Open
himanshu-pro opened this issue Aug 20, 2017 · 0 comments
Open

Can't parse timezone minute offsets #19

himanshu-pro opened this issue Aug 20, 2017 · 0 comments

Comments

@himanshu-pro
Copy link

import apache_log_parser
line_parser = apache_log_parser.make_parser("%t")
data = line_parser("[16/Aug/2013:15:45:34 +0435]")
data
{'time_received': '[16/Aug/2013:15:45:34 +0435]', 'time_received_datetimeobj': datetime.datetime(2013, 8, 16, 15, 45, 34), 'time_received_isoformat': '2013-08-16T15:45:34', 'time_received_tz_datetimeobj': datetime.datetime(2013, 8, 16, 15, 45, 34, tzinfo='0435'), 'time_received_tz_isoformat': '2013-08-16T15:45:34+04:03', 'time_received_utc_datetimeobj': datetime.datetime(2013, 8, 16, 11, 42, 34, tzinfo='0000'), 'time_received_utc_isoformat': '2013-08-16T11:42:34+00:00'}

while expected is:

{'time_received': '[16/Aug/2013:15:45:34 +0435]', 'time_received_datetimeobj': datetime.datetime(2013, 8, 16, 15, 45, 34), 'time_received_isoformat': '2013-08-16T15:45:34', 'time_received_tz_datetimeobj': datetime.datetime(2013, 8, 16, 15, 45, 34, tzinfo='0435'), 'time_received_tz_isoformat': '2013-08-16T15:45:34+04:35', 'time_received_utc_datetimeobj': datetime.datetime(2013, 8, 16, 11, 10, 34, tzinfo='0000'), 'time_received_utc_isoformat': '2013-08-16T11:10:34+00:00'}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant