def unixtime_to_datetime ( ut ) : dt = datetime . datetime . utcfromtimestamp ( ut ) dt = dt . replace ( tzinfo = tz . tzutc ( ) ) return dt
unix utc to datetime in python
Convert a unixtime timestamp to a datetime object . The function converts a timestamp in Unix format to a datetime object . UTC timezone will also be set . : param ut : Unix timestamp to convert : returns : a datetime object : raises InvalidDateError : when the given timestamp cannot be converted into a valid date
def unixtime_to_datetime(ut):
    """Convert a unixtime timestamp to a datetime object.
    The function converts a timestamp in Unix format to a
    datetime object. UTC timezone will also be set.
    :param ut: Unix timestamp to convert
    :returns: a datetime object
    :raises InvalidDateError: when the given timestamp cannot be
        converted into a valid date
    """

    dt = datetime.datetime.utcfromtimestamp(ut)
    dt = dt.replace(tzinfo=tz.tzutc())
    return dt