Using Date and Time Data

Microsoft® SQL Server™ has the datetime and smalldatetime data types to store date and time data.

There are no separate time and date data types for storing only times or only dates. If only a time is specified when setting a datetime or smalldatetime value, the date defaults to January 1, 1900. If only a date is specified, the time defaults to 12:00AM (Midnight).

On datetime data you can perform operations such as:

You can perform some arithmetic calculations on datetime data with the system date functions. For more information, see Functions.

Here are some guidelines when using date and time data:

SQL Server recognizes date and time data enclosed in single quotation marks (‘) in these formats:

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.