blob: 8d351ae697083892072dc30f632bff8c3a2ae207 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# -*- coding: utf-8 -*-
"""Utility functions."""
import datetime
def timestamp_field_to_datetime(json, fieldname):
"""Convert field from timestamp to datetime for json.
Currently hardcoded to MST timezone
"""
timestamp = json[fieldname]
mst_hours = datetime.timedelta(hours=7)
json[fieldname] = datetime.datetime.fromtimestamp(timestamp) + mst_hours
return json
|