Set the system date and time. Each argument is an element of the date, but
    not required. If an element is not passed, the current system value for
    that element will be used. For example, if you don't pass the year, the
    current system year will be used. (Used by set_system_date and
    set_system_time)

    Updates hardware clock, if present, in addition to software
    (kernel) clock.

    :param int years: Years digit, ie: 2015
    :param int months: Months digit: 1 - 12
    :param int days: Days digit: 1 - 31
    :param int hours: Hours digit: 0 - 23
    :param int minutes: Minutes digit: 0 - 59
    :param int seconds: Seconds digit: 0 - 59
    :param str utc_offset: The utc offset in 4 digit (+0600) format with an
        optional sign (+/-).  Will default to None which will use the local
        timezone. To set the time based off of UTC use "'+0000'". Note: if
        being passed through the command line will need to be quoted twice to
        allow negative offsets.
    :return: True if successful. Otherwise False.
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' system.set_system_date_time 2015 5 12 11 37 53 "'-0500'"

def set_system_date_time(years=None,
                         months=None,
                         days=None,
                         hours=None,
                         minutes=None,
                         seconds=None,
                         utc_offset=None):
    '''
    Set the system date and time. Each argument is an element of the date, but
    not required. If an element is not passed, the current system value for
    that element will be used. For example, if you don't pass the year, the
    current system year will be used. (Used by set_system_date and
    set_system_time)

    Updates hardware clock, if present, in addition to software
    (kernel) clock.

    :param int years: Years digit, ie: 2015
    :param int months: Months digit: 1 - 12
    :param int days: Days digit: 1 - 31
    :param int hours: Hours digit: 0 - 23
    :param int minutes: Minutes digit: 0 - 59
    :param int seconds: Seconds digit: 0 - 59
    :param str utc_offset: The utc offset in 4 digit (+0600) format with an
        optional sign (+/-).  Will default to None which will use the local
        timezone. To set the time based off of UTC use "'+0000'". Note: if
        being passed through the command line will need to be quoted twice to
        allow negative offsets.
    :return: True if successful. Otherwise False.
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' system.set_system_date_time 2015 5 12 11 37 53 "'-0500'"
    '''
    # Get the current date/time
    date_time = _get_offset_time(utc_offset)

    # Check for passed values. If not passed, use current values
    if years is None:
        years = date_time.year
    if months is None:
        months = date_time.month
    if days is None:
        days = date_time.day
    if hours is None:
        hours = date_time.hour
    if minutes is None:
        minutes = date_time.minute
    if seconds is None:
        seconds = date_time.second

    try:
        new_datetime = datetime(years, months, days, hours, minutes, seconds, 0,
                                date_time.tzinfo)
    except ValueError as err:
        raise SaltInvocationError(err.message)

    if not _date_bin_set_datetime(new_datetime):
        return False

    if has_settable_hwclock():
        # Now that we've successfully set the software clock, we should
        # update hardware clock for time to persist though reboot.
        return _swclock_to_hwclock()

    return True