def set_date(cdate, is_first_loop, is_force_read_cache, arg_date):
    """set date given context

    (read cache, get today date or set date argument)

    Parameters
    ----------
    is_first_loop : bool
        true on first calendar call
    is_force_read_cache : bool
        force date from cache
    arg_date : str
        date in '%m%Y' format

    Returns
    -------
    CacheDate
       CacheDate object that contain the date to display
    """

    if not is_first_loop or is_force_read_cache:
        cdate.read_cache() # read previous date
    elif is_first_loop and arg_date:
        cdate.set_month(arg_date) # command line force date
    else: # at first loop if no force option
        cdate.now()

    return cdate