Posts

Showing posts with the label date

Date and Time Types

Image
Introduction Next, we will explore Date and Time Types as follows: DATE Only stores date, month and year. Completely ignores time or time zone. Used for birth dates, founding dates, holidays, etc. The INSERT method uses the standard ISO YYYY-MM-DD string format. TIME ( TIME without time zone) Only stores hours, minutes and seconds in a day without date and time zone. Suitable for store opening/closing hours, alarm times, etc. TIMETZ ( TIME with time zone) Stores time of day with a time zone offset. This data type is rarely used in practice because it only stores time and time zone without date information, making application scenarios scarce. TIMESTAMP ( TIMESTAMP without time zone) Stores date, month, year, hours, minutes, seconds and fractional seconds (up to 6 decimal places). Note that it DOES NOT store time zone information. If you input 2026-07-28 10:00:00+07 , Postgres will ignore +07 and store only 2026-07-28 10:00:00 . When retrieving data, regardless of where the D...