SQL Flow Field Guide

SET DATEFORMAT

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

order of date parts when parsing strings; changes conversions

What changes

Input
none
Output or change
session state

Syntax at a glance

SET DATEFORMAT { format | @format_var }

Work example

A date or time calculation must use the explicit calendar behavior controlled by SET DATEFORMAT.

Test month, week, daylight-saving, and boundary values. Prefer typed date or time-zone conversion over parsing an ambiguous string.

Check your work SET DATEFORMAT. The boundary results for SET DATEFORMAT match the named locale or time-zone rule and do not depend on a login default.

Open Microsoft Learn for full syntax, permissions, and details for your version.