def now_time ( str = False ) : if str : return datetime . datetime . now ( ) . strftime ( "%Y-%m-%d %H:%M:%S" ) return datetime . datetime . now ( )
python dateutil how to get current date/time
Get the current time .
def now_time(str=False):
    """Get the current time."""
    if str:
        return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    return datetime.datetime.now()