from datetime import datetime


def dateformat(dtime=None):
    """Formats a date.

    Args:
        dtime: The datetime. If None, this will be the current time.
    """
    if dtime is None:
        dtime = datetime.now()
    return dtime.strftime("%Y-%m-%d %H:%M:%S")