Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Date/Time Literals

When working with date and time functions, you often need to express a specific date, time, or timestamp as a literal value. There are three types of date/time literals. You have one format for expressing a date, one for expressing a time, and one for expressing a date timestamp. This section shows the format and an example of each date/time literal type. These formats are fixed, and you cannot express dates in any other way. This does not mean that the date must display in this format. When you express a date literal, you must comply with the data format in the database, but you can format these values to display in any of the other date formats by formatting the column data.

To express a date/time literal, use the keyword DATE, TIME, or TIMESTAMP followed by a date or time string enclosed in single quote marks. You must use four digits for the year and two digits for all other components, even if the value is a single digit.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint