Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/t-sql/data-types/datetime-transact-sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ SELECT @datetime AS '@datetime',
When the conversion is from **datetimeoffset(*n*)**, the date and time components are copied. The time zone is truncated. When the fractional precision of the **datetimeoffset(*n*)** value is greater than three digits, the value is [rounded](#rounding-of-datetime-fractional-second-precision) to the nearest **datetime** increment (`.000`, `.003`, or `.007` seconds). The following example shows the results of converting a `DATETIMEOFFSET(4)` value to a `DATETIME` value.

```sql
DECLARE @datetimeoffset AS DATETIMEOFFSET (4) = '1968-10-23 12:45:37.0017 +10:0';
DECLARE @datetimeoffset AS DATETIMEOFFSET (4) = '1968-10-23 12:45:37.0017 +10:00';
DECLARE @datetime AS DATETIME = @datetimeoffset;

SELECT @datetime AS '@datetime',
Expand All @@ -289,7 +289,7 @@ SELECT @datetime AS '@datetime',
```output
@datetime @datetimeoffset
------------------------ -------------------------------
1968-10-23 12:45:37.003 1968-10-23 12:45:37.0017 +10:0
1968-10-23 12:45:37.003 1968-10-23 12:45:37.0017 +10:00
```

When the conversion is from **datetime2(*n*)**, the date and time are copied. When the fractional precision of the **datetime2(*n*)** value is greater than three digits, the value is [rounded](#rounding-of-datetime-fractional-second-precision) to the nearest **datetime** increment (`.000`, `.003`, or `.007` seconds). The following example shows the results of converting a `DATETIME2(4)` value to a `DATETIME` value.
Expand Down