def convert(value):
    """Convert value in milliseconds to a string."""
    milliseconds = value % 1000
    value = value // 1000
    seconds = value % 60
    value = value // 60
    minutes = value % 60
    value = value // 60
    hours = value % 24
    value = value // 24
    days = value
    if days:
        result = "%dd%dh%dm" % (days, hours, minutes)
    elif hours:
        result = "%dh%dm%ds" % (hours, minutes, seconds)
    elif minutes:
        result = "%dm%ds" % (minutes, seconds)
    elif seconds:
        result = "%d.%03ds" % (seconds, milliseconds)
    else:
        result = "%dms" % milliseconds

    return result