Sex offenders web site - 636 CHAPTER 28 FROM DATABASES TO DATATYPES

636 CHAPTER 28 FROM DATABASES TO DATATYPES Date and Time Datatypes Numerous types are available for representing time- and date-based data. The TIME, TIMESTAMP, and INTERVAL datatypes can be declared with a precision value using the optional (p) argument. This argument specifies the number of fractional digits retained in the seconds field. DATE The DATE datatype is responsible for storing date information. By default, PostgreSQL displays DATE values in a standard YYYY-MM-DD format, although the values can be inserted using strings in a variety of different formats. For example, both ‘20040810′ and ‘2004-08-10′ would be accepted as valid input. The range for the DATE datatype is 4713 BCto 32767 AD, and the storage requirement is 4 bytes. Note For all date and time datatypes, PostgreSQL accepts any type of nonalphanumeric delimiter to separate the various date and time values. For example, ‘20040810′, ‘2004*08*10′, ‘2004, 08, 10′, and ‘2004!08!10′ are all the same as far as PostgreSQL is concerned. TIME [(p)] [without time zone] The TIME datatype is responsible for storing time information. The TIMEdatatype can take input in a number of string formats. The formats ‘04:05:06.789′, ‘04:05 PM’, and ‘040506′ are all examples of valid time input. The range for the TIME datatype is from 00:00:00.00to 23:59:59.99, and the storage requirement is 8 bytes. The following is an example of using the (p) argument in psql: company=# SELECT ‘12:34:56.543′::time(2); time 12:34:56.54 As you can see from the example, we cast the value to a time(2), meaning the time value will be stored only to the last two digits of precision. Normally, you do not have to worry about precision, because by default there is no explicit bound. TIME [(p)] WITH TIME ZONE The TIME datatype is responsible for storing time information along with time zone information. The TIME datatype can take input in a number of string formats. The formats ‘04:05:06.789 PST’, ‘04:05 PM’, and ‘040506-08′ are all examples of valid time input. The range for the TIME datatype is from 00:00:00.00to 23:59:59.99, and the storage requirement is 8 bytes. Tip For datatypes WITHTIMEZONE, if a time zone is not specified, the default system time zone is used. You can view the system time zone with the SHOW TIMEZONE command.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

Leave a Reply