Skip to content

Commit

Permalink
Use named strptime template from 'google.cloud._helpers'.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Dec 3, 2016
1 parent 2084dbc commit c3c325e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion google/cloud/bigquery/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from google.cloud._helpers import _datetime_from_microseconds
from google.cloud._helpers import _datetime_to_rfc3339
from google.cloud._helpers import _microseconds_from_datetime
from google.cloud._helpers import _RFC3339_NO_FRACTION


def _not_null(value, field):
Expand Down Expand Up @@ -57,7 +58,7 @@ def _datetime_from_json(value, field):
"""Coerce 'value' to a datetime, if set or not nullable."""
if _not_null(value, field):
# value will be a string, in YYYY-MM-DDTHH:MM:SS form.
return datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S')
return datetime.datetime.strptime(value, _RFC3339_NO_FRACTION)


def _date_from_json(value, field):
Expand Down

0 comments on commit c3c325e

Please sign in to comment.