def _date(val, outformat, informat=None):
    """Convert the date between specified formats"""
    from datetime import datetime
    if val == 'now':
        return datetime.now().strftime(outformat)
    if val == 'today':
        return datetime.today().strftime(outformat)
    return datetime.strptime(val, informat).strftime(outformat)
