import time


def convert_date(datestr):
    """Convert epoch in us into date string."""
    date = float(datestr)
    if len(datestr) == 16:
        date /= 1000000
    elif len(datestr) == 13:
        date /= 1000
    return time.strftime("%Y-%m-%d", time.localtime(date))