4.3% of net sales for the second quarter and first six months of 2023, respectively, and represented approximately 4.0% and 4.1% of net sales for the second quarter and first six months of 2022, respectively.
Operating income was $619.9, or 20.3% of net sales, and $1,211.6, or 20.1% of net sales, for the second quarter and first six months of 2023, respectively, compared to $648.8, or 20.7% of net sales, and $1,238.6, or 20.3% of net sales, for the second quarter and first six months of 2022, respectively. Operating income for the second quarter of 2023 includes $4.0 of acquisition-related expenses (presented separately in the Condensed Consolidated Statements of Income) comprised of external transaction costs related to acquisitions. Operating income for the first six months of 2023 includes $9.4 of acquisition-related expenses (presented separately in the Condensed Consolidated Statements of Income) comprised of the amortization related to the value associated with acquired backlog resulting from the acquisition that closed in the first quarter of 2023, as well as the external transaction costs incurred in the second quarter of 2023. For the three and six months ended June 30, 2023, the acquisition-related expenses had the effect of decreasing net income by $3.8, or $0.01 per share, and $7.8, or $0.01 per share, respectively. Excluding the effect of these acquisition-related expenses, Adjusted Operating Income and Adjusted Operating Margin, as defined in the “Non-GAAP Financial Measures” section below, were $623.9, or 20.4% of net sales, and $648.8, or 20.7% of net sales, for the three months ended June 30, 2023 and 2022, respectively. Adjusted Operating Income and Adjusted Operating Margin were $1,221.0, or 20.3% of net sales, and $1,238.6, or 20.3% of net sales, for the six months ended June 30, 2023 and 2022, respectively. The slight decrease in Adjusted Operating Income and Adjusted Operating Margin for the second quarter of 2023 relative to the comparable period in 2022 was primarily driven by normal operating leverage on the lower sales volumes, along with the negative impact on operating margin related to acquisitions that are currently operating below the average operating margin of the Company, which was partially offset by the benefit of pricing actions.
Operating income for the Harsh Environment Solutions segment for the second quarter and first six months of 2023 was $240.3, or 27.0% of net sales, and $466.6, or 26.8% of net sales, respectively, compared to $206.5, or 26.1% of net sales, and $389.7, or 25.7% of net sales, for the second quarter and first six months of 2022, respectively. The increases in operating margin for the Harsh Environment Solutions segment for both the second quarter and first six months of 2023 relative to the comparable periods in 2022 were primarily driven by normal operating leverage on the higher sales volumes combined with the benefit of pricing actions, partially offset by the negative impact on operating margin related to acquisitions that are currently operating below the average operating margin of the Company.
Operating income for the Communications Solutions segment for the second quarter and first six months of 2023 was $238.5, or 20.5% of net sales, and $469.1, or 20.5% of net sales, respectively, compared to $303.0, or 22.0% of net sales, and $585.6, or 21.7% of net sales, for the second quarter and first six months of 2022, respectively. The decreases in operating margin for the Communications Solutions segment for both the second quarter and first six months of 2023 relative to the comparable periods in 2022 were primarily driven by normal operating leverage on the lower sales volumes, partially offset by the benefit of pricing actions.
Operating income for the Interconnect and Sensor Systems segment for the second quarter and first six months of 2023 was $185.9, or 18.5% of net sales, and $364.7, or 18.3% of net sales, respectively, compared to $177.5, or 18.3% of net sales, and $337.5, or 18.0% of net sales, for the second quarter and first six months of 2022, respectively. The increases in operating margin for the Interconnect and Sensor Systems segment for the second quarter and first six months of 2023 relative to the comparable periods in 2022 were primarily driven by normal operating leverage on the higher sales volumes combined with the benefit of pricing actions, partially offset by the negative impact on operating margin related to acquisitions that are currently operating below the average operating margin of the Company.
Interest expense for the second quarter and first six months of 2023 was $35.0 and $71.0, respectively, compared to $30.5 and $58.6 for the second quarter and first six months of 2022, respectively. The increase in interest expense is driven by the rising interest rate environment, which primarily impacted borrowings under the Company’s U.S. Commercial Paper Program that were outstanding throughout most of the first six months of 2023.
Provision for income taxes for the second quarter and first six months of 2023 was at an effective tax rate of 21.9%, and 21.4%, respectively. Provision for income taxes for the second quarter and first six months of 2022 was at an effective tax rate of 23.3% and 23.5%, respectively. For the second quarter and first six months of 2023 and 2022, the excess tax benefits resulting from stock option exercise activity had the impact of decreasing the effective tax rate and