You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/odbc/reference/appendixes/sql-to-c-date.md
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,30 +14,31 @@ helpviewer_keywords:
14
14
---
15
15
# SQL to C: Date
16
16
17
-
The identifier for the date ODBC SQL data type is:
18
-
19
-
SQL_TYPE_DATE
17
+
The identifier for the date ODBC SQL data type is:
18
+
19
+
SQL_TYPE_DATE
20
20
21
21
The following table shows the ODBC C data types to which the driver can convert date SQL data. For an explanation of the columns and terms in the table, see [Converting Data from SQL to C Data Types](../../../odbc/reference/appendixes/converting-data-from-sql-to-c-data-types.md).
22
22
23
23
> [!NOTE]
24
-
> For character conversions, *BufferLength* must include space for the null terminator. A date string is 10 characters long (yyyy-mm-dd), so *BufferLength* must be at least 11 bytes to avoid truncation.
25
-
26
-
|C type identifier|Test|**TargetValuePtr*|**StrLen_or_IndPtr*|SQLSTATE|
24
+
> For character conversions, *BufferLength* must include space for the null terminator. A date string is 10 characters long (yyyy-mm-dd), so *BufferLength* must be at least 11 bytes to avoid truncation.
25
+
26
+
|C type identifier|Test|**TargetValuePtr*|**StrLen_or_IndPtr*|SQLSTATE|
|SQL_C_CHAR|*BufferLength* > Character byte length<br /><br /> 11 <= *BufferLength* <= Character byte length<br /><br /> *BufferLength* < 11|Data<br /><br /> Truncated data<br /><br /> Undefined|10<br /><br /> Length of data in bytes<br /><br /> Undefined|n/a<br /><br /> 01004<br /><br /> 22003|
29
29
|SQL_C_WCHAR|*BufferLength* > Character length<br /><br /> 11 <= *BufferLength* <= Character length<br /><br /> *BufferLength* < 11|Data<br /><br /> Truncated data<br /><br /> Undefined|10<br /><br /> Length of data in characters<br /><br /> Undefined|n/a<br /><br /> 01004<br /><br /> 22003|
30
30
|SQL_C_BINARY|Byte length of data <= *BufferLength*<br /><br /> Byte length of data > *BufferLength*|Data<br /><br /> Undefined|Length of data in bytes<br /><br /> Undefined|n/a<br /><br /> 22003|
31
-
|SQL_C_TYPE_DATE|None[a]|Data|6[c]|n/a|
32
-
|SQL_C_TYPE_TIMESTAMP|None[a]|Data[b]|16[c]|n/a|
33
-
34
-
[a]The value of *BufferLength* is ignored for this conversion. The driver assumes that the size of **TargetValuePtr* is the size of the C data type.
35
-
36
-
[b]The driver sets the time fields of the timestamp structure to zero.
37
-
38
-
[c]This is the size of the corresponding C data type.
<sup>1</sup> The value of *BufferLength* is ignored for this conversion. The driver assumes that the size of **TargetValuePtr* is the size of the C data type.
35
+
36
+
<sup>2</sup> The driver sets the time fields of the timestamp structure to zero.
37
+
38
+
<sup>3</sup> This is the size of the corresponding C data type.
39
39
40
40
When the driver converts date SQL data to character C data, the resulting string is in the "*yyyy*-*mm*-*dd*" format. This format isn't affected by the Windows country/region setting.
41
+
41
42
## Related content
42
43
43
44
-[Converting Data from SQL to C Data Types](../../../odbc/reference/appendixes/converting-data-from-sql-to-c-data-types.md)
0 commit comments