def date_input(info_for_s):
    """
    This functions takes date input and checks its correctness. If it is correct, the date in YYYYMMDD format will
        be returned but if the input is incorrect, it will ask user to input data again.
    :param info_for_s: Message to be displayed to the user.
    :return: Valid user input as string.
    """
    s = input(info_for_s)
    bad_input = True
    while bad_input:
        flag = True
        if len(s) != 8:
            print("Date entered is not valid (check length).")
            flag = False
        if flag:
            for ele in s:
                if ord(ele) < ord('0') or ord(ele) > ord('9'):
                    print("Date contains unacceptable char.")
                    flag = False
                    break
        if flag:
            bad_input = False
            break
        s = input(info_for_s)
    return s