Udostępnij za pośrednictwem


ISO 8601 Format

In Microsoft SQL Server 2005, you can specify date and time data by using the ISO 8601 format.

This is the format:

yyyy-mm-ddThh:mm:ss[.mmm]

The T indicates the start of the time part of the datetime value.

To use the ISO 8601 format, you must specify each element in the format. This also includes the punctuation marks that are shown in the format.

Note

The brackets indicate that the fraction of seconds component is optional. The time component is specified in the 24-hour format.

The advantage in using the ISO 8601 format is that it is an international standard. Also, datetime values that are specified by using this format are unambiguous. Also, this format is not affected by the SET DATEFORMAT or SET LANGUAGE settings.

Following are two examples of datetime values that are specified in the ISO 8601 format:

2004-05-23T14:25:10
2004-05-23T14:25:10.487

See Also

Concepts

Using Date and Time Data

Other Resources

Data Types (Transact-SQL)
CAST and CONVERT (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance