Note: Usually, we will use the timestamptz datatype to store the timestamp data values as it is always a good exercise. The timestamp and timestamptz stores the 8 bytes of storage of the timestamp values as we can see in the following command:Īfter successfully executing the above command, we will retrieve the below result:Īs we can see, both the outputs value's in the timestamp column does not modify, however the value in the timestamptz column can be changed based on the new time zone of 'Asia/Calcutta'.The timestamptz datatype is a time zone-related date and time data type, and it is the timestamp with the time zone.Timestamptz: The timestamptz data type is used with a time zone. Timestamp: The timestamp data type is used without time zone one. In PostgreSQL, the TIMESTAMP data type classified into two temporal data types, which are as follows: And it implies that when we convert the time zone of our database server, the timestamp value will be stored in the database and cannot be modified repeatedly. But it does not support any time zone data. In PostgreSQL, the next data type is TIMESTAMP, which can store both TIME and DATE values. And we also see examples of the Timestamp data type, and we also see some accessible timestamp functions like NOW(), CURRENT_TIMESTAMP, CURRENT_TIME, TIMEOFDAY(), and timezone(zone, timestamp), which help us to handle time values more efficiently. In this section, we are going to understand the working of the PostgreSQL Timestamp data type.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |