from datetime import datetime


def fmt_time(t):
    """Format time.
    """
    if t is None:
        return '(-)'
    if isinstance(t, datetime):
        return t.isoformat('T')
    return "%04d-%02d-%02d %02d:%02d:%02d" % t