{"Entry":{"collection":"type","key":"timestamptz","name":"timestamp with time zone","aliases":["timestamptz"],"metadata":{"aliases":["timestamptz"],"category":"Date and time","content_hash":"efafd04cd8eb94d173070f01eada071cc6473421c58f21ae930cf4016cf00f97","imported_at":"2026-09-30T00:40:36.794162+08:00","name":"timestamp with time zone","name_zh":"","slug":"timestamptz","summary":"date and time, including time zone conversion"}},"Definition":{"Collection":"type","Key":"timestamptz","SourceDatabase":"center","Version":"18","SourceTable":"data_type","SourceKey":"timestamptz","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","Facts":{"aliases":["timestamptz"],"casts":[{"castcontext":"i","castfunc":"timestamptz(date)","castmethod":"f","castsource":"date","casttarget":"timestamptz"},{"castcontext":"i","castfunc":"timestamptz(timestamp)","castmethod":"f","castsource":"timestamp","casttarget":"timestamptz"},{"castcontext":"a","castfunc":"date(timestamptz)","castmethod":"f","castsource":"timestamptz","casttarget":"date"},{"castcontext":"a","castfunc":"time(timestamptz)","castmethod":"f","castsource":"timestamptz","casttarget":"time"},{"castcontext":"a","castfunc":"timestamp(timestamptz)","castmethod":"f","castsource":"timestamptz","casttarget":"timestamp"},{"castcontext":"a","castfunc":"timetz(timestamptz)","castmethod":"f","castsource":"timestamptz","casttarget":"timetz"},{"castcontext":"i","castfunc":"timestamptz(timestamptz,int4)","castmethod":"f","castsource":"timestamptz","casttarget":"timestamptz"}],"catalog":{"array_type_name":"_timestamptz","array_type_oid":"1185","descr":"date and time with time zone","oid":"1184","typacl":"_null_","typalign":"d","typanalyze":"-","typarray":"0","typbasetype":"0","typbyval":"FLOAT8PASSBYVAL","typcategory":"D","typcollation":"0","typdefault":"_null_","typdefaultbin":"_null_","typdelim":"','","typelem":"0","typinput":"timestamptz_in","typisdefined":"t","typispreferred":"t","typlen":"8","typmodin":"timestamptztypmodin","typmodout":"timestamptztypmodout","typname":"timestamptz","typnamespace":"pg_catalog","typndims":"0","typnotnull":"f","typoutput":"timestamptz_out","typowner":"POSTGRES","typreceive":"timestamptz_recv","typrelid":"0","typsend":"timestamptz_send","typstorage":"p","typsubscript":"-","typtype":"b","typtypmod":"-1"},"comparison_data":{"aliases":["timestamptz"],"casts":[{"castcontext":"a","castfunc":"date(timestamptz)","castmethod":"f","castsource":"timestamptz","casttarget":"date"},{"castcontext":"a","castfunc":"time(timestamptz)","castmethod":"f","castsource":"timestamptz","casttarget":"time"},{"castcontext":"a","castfunc":"timestamp(timestamptz)","castmethod":"f","castsource":"timestamptz","casttarget":"timestamp"},{"castcontext":"a","castfunc":"timetz(timestamptz)","castmethod":"f","castsource":"timestamptz","casttarget":"timetz"},{"castcontext":"i","castfunc":"timestamptz(date)","castmethod":"f","castsource":"date","casttarget":"timestamptz"},{"castcontext":"i","castfunc":"timestamptz(timestamp)","castmethod":"f","castsource":"timestamp","casttarget":"timestamptz"},{"castcontext":"i","castfunc":"timestamptz(timestamptz,int4)","castmethod":"f","castsource":"timestamptz","casttarget":"timestamptz"}],"catalog":{"array_type_name":"_timestamptz","typacl":"_null_","typalign":"d","typanalyze":"-","typarray":"_timestamptz","typbasetype":"0","typbyval":"FLOAT8PASSBYVAL","typcategory":"D","typcollation":"0","typdefault":"_null_","typdefaultbin":"_null_","typdelim":",","typelem":"0","typinput":"timestamptz_in","typisdefined":"t","typispreferred":"t","typlen":"8","typmodin":"timestamptztypmodin","typmodout":"timestamptztypmodout","typname":"timestamptz","typndims":"0","typnotnull":"f","typoutput":"timestamptz_out","typreceive":"timestamptz_recv","typrelid":"0","typsend":"timestamptz_send","typstorage":"p","typsubscript":"-","typtype":"b","typtypmod":"-1"},"facts":[{"label":"Catalog name","value":"pg_catalog.timestamptz"},{"label":"Declared length","value":"8 bytes"},{"label":"Documented declaration","value":"timestamp [ ( p ) ] with time zone"},{"label":"High Value","value":"294276 AD"},{"label":"Input function","value":"timestamptz_in"},{"label":"Low Value","value":"4713 BC"},{"label":"Output function","value":"timestamptz_out"},{"label":"Resolution","value":"1 microsecond"},{"label":"Storage Size","value":"8 bytes"},{"label":"Storage strategy","value":"plain"},{"label":"Type OID","value":"1184"},{"label":"Type kind","value":"Base type"}],"operator_classes":[{"opcdefault":"f","opcfamily":"brin/datetime_bloom_ops","opcintype":"timestamptz","opckeytype":"timestamptz","opcmethod":"brin","opcname":"timestamptz_bloom_ops"},{"opcdefault":"f","opcfamily":"brin/datetime_minmax_multi_ops","opcintype":"timestamptz","opckeytype":"timestamptz","opcmethod":"brin","opcname":"timestamptz_minmax_multi_ops"},{"opcdefault":"t","opcfamily":"brin/datetime_minmax_ops","opcintype":"timestamptz","opckeytype":"timestamptz","opcmethod":"brin","opcname":"timestamptz_minmax_ops"},{"opcdefault":"t","opcfamily":"btree/datetime_ops","opcintype":"timestamptz","opckeytype":"0","opcmethod":"btree","opcname":"timestamptz_ops"},{"opcdefault":"t","opcfamily":"hash/timestamptz_ops","opcintype":"timestamptz","opckeytype":"0","opcmethod":"hash","opcname":"timestamptz_ops"}],"operators":[{"oprcanhash":"f","oprcanmerge":"f","oprcode":"date_ge_timestamptz","oprcom":"\u003c=(timestamptz,date)","oprjoin":"scalargejoinsel","oprkind":"b","oprleft":"date","oprname":"\u003e=","oprnegate":"\u003c(date,timestamptz)","oprrest":"scalargesel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"date_gt_timestamptz","oprcom":"\u003c(timestamptz,date)","oprjoin":"scalargtjoinsel","oprkind":"b","oprleft":"date","oprname":"\u003e","oprnegate":"\u003c=(date,timestamptz)","oprrest":"scalargtsel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"date_le_timestamptz","oprcom":"\u003e=(timestamptz,date)","oprjoin":"scalarlejoinsel","oprkind":"b","oprleft":"date","oprname":"\u003c=","oprnegate":"\u003e(date,timestamptz)","oprrest":"scalarlesel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"date_lt_timestamptz","oprcom":"\u003e(timestamptz,date)","oprjoin":"scalarltjoinsel","oprkind":"b","oprleft":"date","oprname":"\u003c","oprnegate":"\u003e=(date,timestamptz)","oprrest":"scalarltsel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"date_ne_timestamptz","oprcom":"\u003c\u003e(timestamptz,date)","oprjoin":"neqjoinsel","oprkind":"b","oprleft":"date","oprname":"\u003c\u003e","oprnegate":"=(date,timestamptz)","oprrest":"neqsel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"interval_pl_timestamptz","oprcom":"+(timestamptz,interval)","oprjoin":"-","oprkind":"b","oprleft":"interval","oprname":"+","oprnegate":"0","oprrest":"-","oprresult":"timestamptz","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamp_ge_timestamptz","oprcom":"\u003c=(timestamptz,timestamp)","oprjoin":"scalargejoinsel","oprkind":"b","oprleft":"timestamp","oprname":"\u003e=","oprnegate":"\u003c(timestamp,timestamptz)","oprrest":"scalargesel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamp_gt_timestamptz","oprcom":"\u003c(timestamptz,timestamp)","oprjoin":"scalargtjoinsel","oprkind":"b","oprleft":"timestamp","oprname":"\u003e","oprnegate":"\u003c=(timestamp,timestamptz)","oprrest":"scalargtsel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamp_le_timestamptz","oprcom":"\u003e=(timestamptz,timestamp)","oprjoin":"scalarlejoinsel","oprkind":"b","oprleft":"timestamp","oprname":"\u003c=","oprnegate":"\u003e(timestamp,timestamptz)","oprrest":"scalarlesel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamp_lt_timestamptz","oprcom":"\u003e(timestamptz,timestamp)","oprjoin":"scalarltjoinsel","oprkind":"b","oprleft":"timestamp","oprname":"\u003c","oprnegate":"\u003e=(timestamp,timestamptz)","oprrest":"scalarltsel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamp_ne_timestamptz","oprcom":"\u003c\u003e(timestamptz,timestamp)","oprjoin":"neqjoinsel","oprkind":"b","oprleft":"timestamp","oprname":"\u003c\u003e","oprnegate":"=(timestamp,timestamptz)","oprrest":"neqsel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_ge","oprcom":"\u003c=(timestamptz,timestamptz)","oprjoin":"scalargejoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003e=","oprnegate":"\u003c(timestamptz,timestamptz)","oprrest":"scalargesel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_ge_date","oprcom":"\u003c=(date,timestamptz)","oprjoin":"scalargejoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003e=","oprnegate":"\u003c(timestamptz,date)","oprrest":"scalargesel","oprresult":"bool","oprright":"date"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_ge_timestamp","oprcom":"\u003c=(timestamp,timestamptz)","oprjoin":"scalargejoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003e=","oprnegate":"\u003c(timestamptz,timestamp)","oprrest":"scalargesel","oprresult":"bool","oprright":"timestamp"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_gt","oprcom":"\u003c(timestamptz,timestamptz)","oprjoin":"scalargtjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003e","oprnegate":"\u003c=(timestamptz,timestamptz)","oprrest":"scalargtsel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_gt_date","oprcom":"\u003c(date,timestamptz)","oprjoin":"scalargtjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003e","oprnegate":"\u003c=(timestamptz,date)","oprrest":"scalargtsel","oprresult":"bool","oprright":"date"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_gt_timestamp","oprcom":"\u003c(timestamp,timestamptz)","oprjoin":"scalargtjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003e","oprnegate":"\u003c=(timestamptz,timestamp)","oprrest":"scalargtsel","oprresult":"bool","oprright":"timestamp"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_le","oprcom":"\u003e=(timestamptz,timestamptz)","oprjoin":"scalarlejoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c=","oprnegate":"\u003e(timestamptz,timestamptz)","oprrest":"scalarlesel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_le_date","oprcom":"\u003e=(date,timestamptz)","oprjoin":"scalarlejoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c=","oprnegate":"\u003e(timestamptz,date)","oprrest":"scalarlesel","oprresult":"bool","oprright":"date"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_le_timestamp","oprcom":"\u003e=(timestamp,timestamptz)","oprjoin":"scalarlejoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c=","oprnegate":"\u003e(timestamptz,timestamp)","oprrest":"scalarlesel","oprresult":"bool","oprright":"timestamp"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_lt","oprcom":"\u003e(timestamptz,timestamptz)","oprjoin":"scalarltjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c","oprnegate":"\u003e=(timestamptz,timestamptz)","oprrest":"scalarltsel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_lt_date","oprcom":"\u003e(date,timestamptz)","oprjoin":"scalarltjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c","oprnegate":"\u003e=(timestamptz,date)","oprrest":"scalarltsel","oprresult":"bool","oprright":"date"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_lt_timestamp","oprcom":"\u003e(timestamp,timestamptz)","oprjoin":"scalarltjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c","oprnegate":"\u003e=(timestamptz,timestamp)","oprrest":"scalarltsel","oprresult":"bool","oprright":"timestamp"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_mi","oprcom":"0","oprjoin":"-","oprkind":"b","oprleft":"timestamptz","oprname":"-","oprnegate":"0","oprrest":"-","oprresult":"interval","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_mi_interval","oprcom":"0","oprjoin":"-","oprkind":"b","oprleft":"timestamptz","oprname":"-","oprnegate":"0","oprrest":"-","oprresult":"timestamptz","oprright":"interval"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_ne","oprcom":"\u003c\u003e(timestamptz,timestamptz)","oprjoin":"neqjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c\u003e","oprnegate":"=(timestamptz,timestamptz)","oprrest":"neqsel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_ne_date","oprcom":"\u003c\u003e(date,timestamptz)","oprjoin":"neqjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c\u003e","oprnegate":"=(timestamptz,date)","oprrest":"neqsel","oprresult":"bool","oprright":"date"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_ne_timestamp","oprcom":"\u003c\u003e(timestamp,timestamptz)","oprjoin":"neqjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c\u003e","oprnegate":"=(timestamptz,timestamp)","oprrest":"neqsel","oprresult":"bool","oprright":"timestamp"},{"oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_pl_interval","oprcom":"+(interval,timestamptz)","oprjoin":"-","oprkind":"b","oprleft":"timestamptz","oprname":"+","oprnegate":"0","oprrest":"-","oprresult":"timestamptz","oprright":"interval"},{"oprcanhash":"f","oprcanmerge":"t","oprcode":"date_eq_timestamptz","oprcom":"=(timestamptz,date)","oprjoin":"eqjoinsel","oprkind":"b","oprleft":"date","oprname":"=","oprnegate":"\u003c\u003e(date,timestamptz)","oprrest":"eqsel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"t","oprcode":"timestamp_eq_timestamptz","oprcom":"=(timestamptz,timestamp)","oprjoin":"eqjoinsel","oprkind":"b","oprleft":"timestamp","oprname":"=","oprnegate":"\u003c\u003e(timestamp,timestamptz)","oprrest":"eqsel","oprresult":"bool","oprright":"timestamptz"},{"oprcanhash":"f","oprcanmerge":"t","oprcode":"timestamptz_eq_date","oprcom":"=(date,timestamptz)","oprjoin":"eqjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"=","oprnegate":"\u003c\u003e(timestamptz,date)","oprrest":"eqsel","oprresult":"bool","oprright":"date"},{"oprcanhash":"f","oprcanmerge":"t","oprcode":"timestamptz_eq_timestamp","oprcom":"=(timestamp,timestamptz)","oprjoin":"eqjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"=","oprnegate":"\u003c\u003e(timestamptz,timestamp)","oprrest":"eqsel","oprresult":"bool","oprright":"timestamp"},{"oprcanhash":"t","oprcanmerge":"t","oprcode":"timestamptz_eq","oprcom":"=(timestamptz,timestamptz)","oprjoin":"eqjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"=","oprnegate":"\u003c\u003e(timestamptz,timestamptz)","oprrest":"eqsel","oprresult":"bool","oprright":"timestamptz"}],"ranges":[]},"comparison_hash":"b7c8b3f9894589d926d05ae608ed12f5c51cc8bc49b3c509e30838528162e5fd","coverage":"source inventory; exact declared input types for operator classes","description":["date and time, including time zone"],"facts":[{"label":"Catalog name","value":"pg_catalog.timestamptz"},{"label":"Type OID","value":"1184"},{"label":"Type kind","value":"Base type"},{"label":"Declared length","value":"8 bytes"},{"label":"Storage strategy","value":"plain"},{"label":"Input function","value":"timestamptz_in"},{"label":"Output function","value":"timestamptz_out"},{"label":"Documented declaration","value":"timestamp [ ( p ) ] with time zone"},{"label":"Storage Size","value":"8 bytes"},{"label":"Manual description","value":"both date and time, with time zone"},{"label":"Low Value","value":"4713 BC"},{"label":"High Value","value":"294276 AD"},{"label":"Resolution","value":"1 microsecond"}],"manual_documentation":"dedicated family chapter","manual_html":"\u003cdiv class=\"sect1\" id=\"DATATYPE-DATETIME\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch2 class=\"title\"\u003e8.5. Date/Time Types \u003c/h2\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003cp\u003e\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e supports the full set of SQL date and time types, shown in \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-TABLE\" title=\"Table 8.9. Date/Time Types\"\u003eTable 8.9\u003c/a\u003e. The operations available on these data types are described in \u003ca class=\"xref\" href=\"/docs/18/functions-datetime.html\" title=\"9.9. Date/Time Functions and Operators\"\u003eSection 9.9\u003c/a\u003e. Dates are counted according to the Gregorian calendar, even in years before that calendar was introduced (see \u003ca class=\"xref\" href=\"/docs/18/datetime-units-history.html\" title=\"B.6. History of Units\"\u003eSection B.6\u003c/a\u003e for more information).\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-DATETIME-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.9. Date/Time Types\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eName\u003c/th\u003e\n\u003cth\u003eStorage Size\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003cth\u003eLow Value\u003c/th\u003e\n\u003cth\u003eHigh Value\u003c/th\u003e\n\u003cth\u003eResolution\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003etimestamp [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] [ without time zone ]\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e8 bytes\u003c/td\u003e\n\u003ctd\u003eboth date and time (no time zone)\u003c/td\u003e\n\u003ctd\u003e4713 BC\u003c/td\u003e\n\u003ctd\u003e294276 AD\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003etimestamp [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] with time zone\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e8 bytes\u003c/td\u003e\n\u003ctd\u003eboth date and time, with time zone\u003c/td\u003e\n\u003ctd\u003e4713 BC\u003c/td\u003e\n\u003ctd\u003e294276 AD\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e4 bytes\u003c/td\u003e\n\u003ctd\u003edate (no time of day)\u003c/td\u003e\n\u003ctd\u003e4713 BC\u003c/td\u003e\n\u003ctd\u003e5874897 AD\u003c/td\u003e\n\u003ctd\u003e1 day\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003etime [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] [ without time zone ]\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e8 bytes\u003c/td\u003e\n\u003ctd\u003etime of day (no date)\u003c/td\u003e\n\u003ctd\u003e00:00:00\u003c/td\u003e\n\u003ctd\u003e24:00:00\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003etime [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] with time zone\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e12 bytes\u003c/td\u003e\n\u003ctd\u003etime of day (no date), with time zone\u003c/td\u003e\n\u003ctd\u003e00:00:00+1559\u003c/td\u003e\n\u003ctd\u003e24:00:00-1559\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003einterval [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e ] [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ]\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e16 bytes\u003c/td\u003e\n\u003ctd\u003etime interval\u003c/td\u003e\n\u003ctd\u003e-178000000 years\u003c/td\u003e\n\u003ctd\u003e178000000 years\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eThe SQL standard requires that writing just \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e be equivalent to \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e, and \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e honors that behavior. \u003ccode class=\"type\"\u003etimestamptz\u003c/code\u003e is accepted as an abbreviation for \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e; this is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ccode class=\"type\"\u003etime\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, and \u003ccode class=\"type\"\u003einterval\u003c/code\u003e accept an optional precision value \u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e which specifies the number of fractional digits retained in the seconds field. By default, there is no explicit bound on precision. The allowed range of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e is from 0 to 6.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"type\"\u003einterval\u003c/code\u003e type has an additional option, which is to restrict the set of stored fields by writing one of these phrases:\u003c/p\u003e\n\u003cpre class=\"literallayout\"\u003eYEAR\nMONTH\nDAY\nHOUR\nMINUTE\nSECOND\nYEAR TO MONTH\nDAY TO HOUR\nDAY TO MINUTE\nDAY TO SECOND\nHOUR TO MINUTE\nHOUR TO SECOND\nMINUTE TO SECOND\n\u003c/pre\u003e\n\u003cp\u003eNote that if both \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e and \u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e are specified, the \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e must include \u003ccode class=\"literal\"\u003eSECOND\u003c/code\u003e, since the precision applies only to the seconds.\u003c/p\u003e\n\u003cp\u003eThe type \u003ccode class=\"type\"\u003etime with time zone\u003c/code\u003e is defined by the SQL standard, but the definition exhibits properties which lead to questionable usefulness. In most cases, a combination of \u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etime\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e, and \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e should provide a complete range of date/time functionality required by any application.\u003c/p\u003e\n\u003cdiv class=\"sect2\" id=\"DATATYPE-DATETIME-INPUT\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3 class=\"title\"\u003e8.5.1. Date/Time Input \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eDate and time input is accepted in almost any reasonable format, including ISO 8601, SQL-compatible, traditional \u003cspan class=\"productname\"\u003ePOSTGRES\u003c/span\u003e, and others. For some formats, ordering of day, month, and year in date input is ambiguous and there is support for specifying the expected ordering of these fields. Set the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DATESTYLE\"\u003eDateStyle\u003c/a\u003e parameter to \u003ccode class=\"literal\"\u003eMDY\u003c/code\u003e to select month-day-year interpretation, \u003ccode class=\"literal\"\u003eDMY\u003c/code\u003e to select day-month-year interpretation, or \u003ccode class=\"literal\"\u003eYMD\u003c/code\u003e to select year-month-day interpretation.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e is more flexible in handling date/time input than the SQL standard requires. See \u003ca class=\"xref\" href=\"/docs/18/datetime-appendix.html\" title=\"Appendix B. Date/Time Support\"\u003eAppendix B\u003c/a\u003e for the exact parsing rules of date/time input and for the recognized text fields including months, days of the week, and time zones.\u003c/p\u003e\n\u003cp\u003eRemember that any date or time literal input needs to be enclosed in single quotes, like text strings. Refer to \u003ca class=\"xref\" href=\"/docs/18/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-GENERIC\" title=\"4.1.2.7. Constants of Other Types\"\u003eSection 4.1.2.7\u003c/a\u003e for more information. SQL requires the following syntax\u003c/p\u003e\n\u003cpre class=\"synopsis\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003etype\u003c/code\u003e\u003c/em\u003e [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] '\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e'\n\u003c/pre\u003e\n\u003cp\u003ewhere \u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e is an optional precision specification giving the number of fractional digits in the seconds field. Precision can be specified for \u003ccode class=\"type\"\u003etime\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, and \u003ccode class=\"type\"\u003einterval\u003c/code\u003e types, and can range from 0 to 6. If no precision is specified in a constant specification, it defaults to the precision of the literal value (but not more than 6 digits).\u003c/p\u003e\n\u003cdiv class=\"sect3\" id=\"DATATYPE-DATETIME-INPUT-DATES\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch4 class=\"title\"\u003e8.5.1.1. Dates \u003c/h4\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-DATE-TABLE\" title=\"Table 8.10. Date Input\"\u003eTable 8.10\u003c/a\u003e shows some possible inputs for the \u003ccode class=\"type\"\u003edate\u003c/code\u003e type.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-DATETIME-DATE-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.10. Date Input\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e1999-01-08\u003c/td\u003e\n\u003ctd\u003eISO 8601; January 8 in any mode (recommended format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJanuary 8, 1999\u003c/td\u003e\n\u003ctd\u003eunambiguous in any \u003ccode class=\"varname\"\u003edatestyle\u003c/code\u003e input mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1/8/1999\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in \u003ccode class=\"literal\"\u003eMDY\u003c/code\u003e mode; August 1 in \u003ccode class=\"literal\"\u003eDMY\u003c/code\u003e mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1/18/1999\u003c/td\u003e\n\u003ctd\u003eJanuary 18 in \u003ccode class=\"literal\"\u003eMDY\u003c/code\u003e mode; rejected in other modes\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e01/02/03\u003c/td\u003e\n\u003ctd\u003eJanuary 2, 2003 in \u003ccode class=\"literal\"\u003eMDY\u003c/code\u003e mode; February 1, 2003 in \u003ccode class=\"literal\"\u003eDMY\u003c/code\u003e mode; February 3, 2001 in \u003ccode class=\"literal\"\u003eYMD\u003c/code\u003e mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1999-Jan-08\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJan-08-1999\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e08-Jan-1999\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e99-Jan-08\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in \u003ccode class=\"literal\"\u003eYMD\u003c/code\u003e mode, else error\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e08-Jan-99\u003c/td\u003e\n\u003ctd\u003eJanuary 8, except error in \u003ccode class=\"literal\"\u003eYMD\u003c/code\u003e mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJan-08-99\u003c/td\u003e\n\u003ctd\u003eJanuary 8, except error in \u003ccode class=\"literal\"\u003eYMD\u003c/code\u003e mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e19990108\u003c/td\u003e\n\u003ctd\u003eISO 8601; January 8, 1999 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e990108\u003c/td\u003e\n\u003ctd\u003eISO 8601; January 8, 1999 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1999.008\u003c/td\u003e\n\u003ctd\u003eyear and day of year\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJ2451187\u003c/td\u003e\n\u003ctd\u003eJulian date\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJanuary 8, 99 BC\u003c/td\u003e\n\u003ctd\u003eyear 99 BC\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect3\" id=\"DATATYPE-DATETIME-INPUT-TIMES\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch4 class=\"title\"\u003e8.5.1.2. Times \u003c/h4\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eThe time-of-day types are \u003ccode class=\"type\"\u003etime [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] without time zone\u003c/code\u003e and \u003ccode class=\"type\"\u003etime [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] with time zone\u003c/code\u003e. \u003ccode class=\"type\"\u003etime\u003c/code\u003e alone is equivalent to \u003ccode class=\"type\"\u003etime without time zone\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eValid input for these types consists of a time of day followed by an optional time zone. (See \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-TIME-TABLE\" title=\"Table 8.11. Time Input\"\u003eTable 8.11\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONE-TABLE\" title=\"Table 8.12. Time Zone Input\"\u003eTable 8.12\u003c/a\u003e.) If a time zone is specified in the input for \u003ccode class=\"type\"\u003etime without time zone\u003c/code\u003e, it is silently ignored. You can also specify a date but it will be ignored, except when you use a time zone name that involves a daylight-savings rule, such as \u003ccode class=\"literal\"\u003eAmerica/New_York\u003c/code\u003e. In this case specifying the date is required in order to determine whether standard or daylight-savings time applies. The appropriate time zone offset is recorded in the \u003ccode class=\"type\"\u003etime with time zone\u003c/code\u003e value and is output as stored; it is not adjusted to the active time zone.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-DATETIME-TIME-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.11. Time Input\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05:06.789\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05:06\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e040506\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05 AM\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003esame as 04:05; AM does not affect value\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05 PM\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003esame as 16:05; input hour must be \u0026lt;= 12\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05:06.789-8\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05:06-08:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05-08:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e040506-08\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e040506+0730\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with fractional-hour time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e040506+07:30:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset specified to seconds (not allowed in ISO 8601)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05:06 PST\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003etime zone specified by abbreviation\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e2003-04-12 04:05:06 America/New_York\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003etime zone specified by full name\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-TIMEZONE-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.12. Time Zone Input\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003ePST\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eAbbreviation (for Pacific Standard Time)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eAmerica/New_York\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eFull time zone name\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003ePST8PDT\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003ePOSIX-style time zone specification\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e-8:00:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset for PST\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e-8:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset for PST (ISO 8601 extended format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e-800\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset for PST (ISO 8601 basic format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e-8\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset for PST (ISO 8601 basic format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003ezulu\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eMilitary abbreviation for UTC\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003ez\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eShort form of \u003ccode class=\"literal\"\u003ezulu\u003c/code\u003e (also in ISO 8601)\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cp\u003eRefer to \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3. Time Zones\"\u003eSection 8.5.3\u003c/a\u003e for more information on how to specify time zones.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect3\" id=\"DATATYPE-DATETIME-INPUT-TIME-STAMPS\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch4 class=\"title\"\u003e8.5.1.3. Time Stamps \u003c/h4\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eValid input for the time stamp types consists of the concatenation of a date and a time, followed by an optional time zone, followed by an optional \u003ccode class=\"literal\"\u003eAD\u003c/code\u003e or \u003ccode class=\"literal\"\u003eBC\u003c/code\u003e. (Alternatively, \u003ccode class=\"literal\"\u003eAD\u003c/code\u003e/\u003ccode class=\"literal\"\u003eBC\u003c/code\u003e can appear before the time zone, but this is not the preferred ordering.) Thus:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003e1999-01-08 04:05:06\n\u003c/pre\u003e\n\u003cp\u003eand:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003e1999-01-08 04:05:06 -8:00\n\u003c/pre\u003e\n\u003cp\u003eare valid values, which follow the ISO 8601 standard. In addition, the common format:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eJanuary 8 04:05:06 1999 PST\n\u003c/pre\u003e\n\u003cp\u003eis supported.\u003c/p\u003e\n\u003cp\u003eThe SQL standard differentiates \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e and \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e literals by the presence of a \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e+\u003c/span\u003e”\u003c/span\u003e or \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e-\u003c/span\u003e”\u003c/span\u003e symbol and time zone offset after the time. Hence, according to the standard,\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eTIMESTAMP '2004-10-19 10:23:54'\n\u003c/pre\u003e\n\u003cp\u003eis a \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e, while\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eTIMESTAMP '2004-10-19 10:23:54+02'\n\u003c/pre\u003e\n\u003cp\u003eis a \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e never examines the content of a literal string before determining its type, and therefore will treat both of the above as \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e. To ensure that a literal is treated as \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, give it the correct explicit type:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eTIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+02'\n\u003c/pre\u003e\n\u003cp\u003eIn a value that has been determined to be \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e, \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e will silently ignore any time zone indication. That is, the resulting value is derived from the date/time fields in the input string, and is not adjusted for time zone.\u003c/p\u003e\n\u003cp\u003eFor \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e values, an input string that includes an explicit time zone will be converted to UTC (\u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-UTC\"\u003e\u003c/a\u003e\u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-UTC\" title=\"UTC\"\u003eUniversal Coordinated Time\u003c/a\u003e) using the appropriate offset for that time zone. If no time zone is stated in the input string, then it is assumed to be in the time zone indicated by the system's \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\"\u003eTimeZone\u003c/a\u003e parameter, and is converted to UTC using the offset for the \u003ccode class=\"varname\"\u003etimezone\u003c/code\u003e zone. In either case, the value is stored internally as UTC, and the originally stated or assumed time zone is not retained.\u003c/p\u003e\n\u003cp\u003eWhen a \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e value is output, it is always converted from UTC to the current \u003ccode class=\"varname\"\u003etimezone\u003c/code\u003e zone, and displayed as local time in that zone. To see the time in another time zone, either change \u003ccode class=\"varname\"\u003etimezone\u003c/code\u003e or use the \u003ccode class=\"literal\"\u003eAT TIME ZONE\u003c/code\u003e construct (see \u003ca class=\"xref\" href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT\" title=\"9.9.4. AT TIME ZONE and AT LOCAL\"\u003eSection 9.9.4\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eConversions between \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e and \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e normally assume that the \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e value should be taken or given as \u003ccode class=\"varname\"\u003etimezone\u003c/code\u003e local time. A different time zone can be specified for the conversion using \u003ccode class=\"literal\"\u003eAT TIME ZONE\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect3\" id=\"DATATYPE-DATETIME-SPECIAL-VALUES\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch4 class=\"title\"\u003e8.5.1.4. Special Values \u003c/h4\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e supports several special date/time input values for convenience, as shown in \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-SPECIAL-TABLE\" title=\"Table 8.13. Special Date/Time Inputs\"\u003eTable 8.13\u003c/a\u003e. The values \u003ccode class=\"literal\"\u003einfinity\u003c/code\u003e and \u003ccode class=\"literal\"\u003e-infinity\u003c/code\u003e are specially represented inside the system and will be displayed unchanged; but the others are simply notational shorthands that will be converted to ordinary date/time values when read. (In particular, \u003ccode class=\"literal\"\u003enow\u003c/code\u003e and related strings are converted to a specific time value as soon as they are read.) All of these values need to be enclosed in single quotes when used as constants in SQL commands.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-DATETIME-SPECIAL-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.13. Special Date/Time Inputs\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eInput String\u003c/th\u003e\n\u003cth\u003eValid Types\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eepoch\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e1970-01-01 00:00:00+00 (Unix system time zero)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003einfinity\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003einterval\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003elater than all other time stamps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e-infinity\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003einterval\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eearlier than all other time stamps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003enow\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etime\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003ecurrent transaction's start time\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003etoday\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003emidnight (\u003ccode class=\"literal\"\u003e00:00\u003c/code\u003e) today\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003etomorrow\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003emidnight (\u003ccode class=\"literal\"\u003e00:00\u003c/code\u003e) tomorrow\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eyesterday\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003emidnight (\u003ccode class=\"literal\"\u003e00:00\u003c/code\u003e) yesterday\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eallballs\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003etime\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e00:00:00.00 UTC\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cp\u003eThe following SQL-compatible functions can also be used to obtain the current time value for the corresponding data type: \u003ccode class=\"literal\"\u003eCURRENT_DATE\u003c/code\u003e, \u003ccode class=\"literal\"\u003eCURRENT_TIME\u003c/code\u003e, \u003ccode class=\"literal\"\u003eCURRENT_TIMESTAMP\u003c/code\u003e, \u003ccode class=\"literal\"\u003eLOCALTIME\u003c/code\u003e, \u003ccode class=\"literal\"\u003eLOCALTIMESTAMP\u003c/code\u003e. (See \u003ca class=\"xref\" href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT\" title=\"9.9.5. Current Date/Time\"\u003eSection 9.9.5\u003c/a\u003e.) Note that these are SQL functions and are \u003cspan class=\"emphasis\"\u003e\u003cem\u003enot\u003c/em\u003e\u003c/span\u003e recognized in data input strings.\u003c/p\u003e\n\u003cdiv class=\"caution\"\u003e\n\u003ch3 class=\"title\"\u003eCaution\u003c/h3\u003e\n\u003cp\u003eWhile the input strings \u003ccode class=\"literal\"\u003enow\u003c/code\u003e, \u003ccode class=\"literal\"\u003etoday\u003c/code\u003e, \u003ccode class=\"literal\"\u003etomorrow\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eyesterday\u003c/code\u003e are fine to use in interactive SQL commands, they can have surprising behavior when the command is saved to be executed later, for example in prepared statements, views, and function definitions. The string can be converted to a specific time value that continues to be used long after it becomes stale. Use one of the SQL functions instead in such contexts. For example, \u003ccode class=\"literal\"\u003eCURRENT_DATE + 1\u003c/code\u003e is safer than \u003ccode class=\"literal\"\u003e'tomorrow'::date\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect2\" id=\"DATATYPE-DATETIME-OUTPUT\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3 class=\"title\"\u003e8.5.2. Date/Time Output \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eThe output format of the date/time types can be set to one of the four styles ISO 8601, SQL (Ingres), traditional \u003cspan class=\"productname\"\u003ePOSTGRES\u003c/span\u003e (Unix \u003cspan class=\"application\"\u003edate\u003c/span\u003e format), or German. The default is the ISO format. (The SQL standard requires the use of the ISO 8601 format. The name of the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eSQL\u003c/span\u003e”\u003c/span\u003e output format is a historical accident.) \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT-TABLE\" title=\"Table 8.14. Date/Time Output Styles\"\u003eTable 8.14\u003c/a\u003e shows examples of each output style. The output of the \u003ccode class=\"type\"\u003edate\u003c/code\u003e and \u003ccode class=\"type\"\u003etime\u003c/code\u003e types is generally only the date or time part in accordance with the given examples. However, the \u003cspan class=\"productname\"\u003ePOSTGRES\u003c/span\u003e style outputs date-only values in ISO format.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-DATETIME-OUTPUT-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.14. Date/Time Output Styles\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eStyle Specification\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eISO\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, SQL standard\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e1997-12-17 07:37:16-08\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eSQL\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003etraditional style\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e12/17/1997 07:37:16.00 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003ePostgres\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eoriginal style\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eWed Dec 17 07:37:16 1997 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eGerman\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eregional style\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e17.12.1997 07:37:16.00 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eISO 8601 specifies the use of uppercase letter \u003ccode class=\"literal\"\u003eT\u003c/code\u003e to separate the date and time. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e accepts that format on input, but on output it uses a space rather than \u003ccode class=\"literal\"\u003eT\u003c/code\u003e, as shown above. This is for readability and for consistency with \u003ca class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc3339\"\u003eRFC 3339\u003c/a\u003e as well as some other database systems.\u003c/p\u003e\n\u003c/div\u003e\n\u003cp\u003eIn the SQL and POSTGRES styles, day appears before month if DMY field ordering has been specified, otherwise month appears before day. (See \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-INPUT\" title=\"8.5.1. Date/Time Input\"\u003eSection 8.5.1\u003c/a\u003e for how this setting also affects interpretation of input values.) \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT2-TABLE\" title=\"Table 8.15. Date Order Conventions\"\u003eTable 8.15\u003c/a\u003e shows examples.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-DATETIME-OUTPUT2-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.15. Date Order Conventions\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003e\u003ccode class=\"varname\"\u003edatestyle\u003c/code\u003e Setting\u003c/th\u003e\n\u003cth\u003eInput Ordering\u003c/th\u003e\n\u003cth\u003eExample Output\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eSQL, DMY\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eday\u003c/code\u003e\u003c/em\u003e/\u003cem class=\"replaceable\"\u003e\u003ccode\u003emonth\u003c/code\u003e\u003c/em\u003e/\u003cem class=\"replaceable\"\u003e\u003ccode\u003eyear\u003c/code\u003e\u003c/em\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e17/12/1997 15:37:16.00 CET\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eSQL, MDY\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003emonth\u003c/code\u003e\u003c/em\u003e/\u003cem class=\"replaceable\"\u003e\u003ccode\u003eday\u003c/code\u003e\u003c/em\u003e/\u003cem class=\"replaceable\"\u003e\u003ccode\u003eyear\u003c/code\u003e\u003c/em\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e12/17/1997 07:37:16.00 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003ePostgres, DMY\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eday\u003c/code\u003e\u003c/em\u003e/\u003cem class=\"replaceable\"\u003e\u003ccode\u003emonth\u003c/code\u003e\u003c/em\u003e/\u003cem class=\"replaceable\"\u003e\u003ccode\u003eyear\u003c/code\u003e\u003c/em\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eWed 17 Dec 07:37:16 1997 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cp\u003eIn the ISO style, the time zone is always shown as a signed numeric offset from UTC, with positive sign used for zones east of Greenwich. The offset will be shown as \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehh\u003c/code\u003e\u003c/em\u003e (hours only) if it is an integral number of hours, else as \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehh\u003c/code\u003e\u003c/em\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003emm\u003c/code\u003e\u003c/em\u003e if it is an integral number of minutes, else as \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehh\u003c/code\u003e\u003c/em\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003emm\u003c/code\u003e\u003c/em\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003ess\u003c/code\u003e\u003c/em\u003e. (The third case is not possible with any modern time zone standard, but it can appear when working with timestamps that predate the adoption of standardized time zones.) In the other date styles, the time zone is shown as an alphabetic abbreviation if one is in common use in the current zone. Otherwise it appears as a signed numeric offset in ISO 8601 basic format (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehh\u003c/code\u003e\u003c/em\u003e or \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehhmm\u003c/code\u003e\u003c/em\u003e). The alphabetic abbreviations shown in these styles are taken from the IANA time zone database entry currently selected by the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\"\u003eTimeZone\u003c/a\u003e run-time parameter; they are not affected by the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE-ABBREVIATIONS\"\u003etimezone_abbreviations\u003c/a\u003e setting.\u003c/p\u003e\n\u003cp\u003eThe date/time style can be selected by the user using the \u003ccode class=\"command\"\u003eSET datestyle\u003c/code\u003e command, the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DATESTYLE\"\u003eDateStyle\u003c/a\u003e parameter in the \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e configuration file, or the \u003ccode class=\"envar\"\u003ePGDATESTYLE\u003c/code\u003e environment variable on the server or client.\u003c/p\u003e\n\u003cp\u003eThe formatting function \u003ccode class=\"function\"\u003eto_char\u003c/code\u003e (see \u003ca class=\"xref\" href=\"/docs/18/functions-formatting.html\" title=\"9.8. Data Type Formatting Functions\"\u003eSection 9.8\u003c/a\u003e) is also available as a more flexible way to format date/time output.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect2\" id=\"DATATYPE-TIMEZONES\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3 class=\"title\"\u003e8.5.3. Time Zones \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eTime zones, and time-zone conventions, are influenced by political decisions, not just earth geometry. Time zones around the world became somewhat standardized during the 1900s, but continue to be prone to arbitrary changes, particularly with respect to daylight-savings rules. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e uses the widely-used IANA (Olson) time zone database for information about historical time zone rules. For times in the future, the assumption is that the latest known rules for a given time zone will continue to be observed indefinitely far into the future.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e endeavors to be compatible with the SQL standard definitions for typical usage. However, the SQL standard has an odd mix of date and time types and capabilities. Two obvious problems are:\u003c/p\u003e\n\u003cdiv class=\"itemizedlist\"\u003e\n\u003cul class=\"itemizedlist\"\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eAlthough the \u003ccode class=\"type\"\u003edate\u003c/code\u003e type cannot have an associated time zone, the \u003ccode class=\"type\"\u003etime\u003c/code\u003e type can. Time zones in the real world have little meaning unless associated with a date as well as a time, since the offset can vary through the year with daylight-saving time boundaries.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eThe default time zone is specified as a constant numeric offset from UTC. It is therefore impossible to adapt to daylight-saving time when doing date/time arithmetic across DST boundaries.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003cp\u003eTo address these difficulties, we recommend using date/time types that contain both date and time when using time zones. We do \u003cspan class=\"emphasis\"\u003e\u003cem\u003enot\u003c/em\u003e\u003c/span\u003e recommend using the type \u003ccode class=\"type\"\u003etime with time zone\u003c/code\u003e (though it is supported by \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e for legacy applications and for compliance with the SQL standard). \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e assumes your local time zone for any type containing only date or time.\u003c/p\u003e\n\u003cp\u003eAll timezone-aware dates and times are stored internally in UTC. They are converted to local time in the zone specified by the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\"\u003eTimeZone\u003c/a\u003e configuration parameter before being displayed to the client.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e allows you to specify time zones in three different forms:\u003c/p\u003e\n\u003cdiv class=\"itemizedlist\"\u003e\n\u003cul class=\"itemizedlist\"\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eA full time zone name, for example \u003ccode class=\"literal\"\u003eAmerica/New_York\u003c/code\u003e. The recognized time zone names are listed in the \u003ccode class=\"literal\"\u003epg_timezone_names\u003c/code\u003e view (see \u003ca class=\"xref\" href=\"/docs/18/view-pg-timezone-names.html\" title=\"53.34. pg_timezone_names\"\u003eSection 53.34\u003c/a\u003e). \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e uses the widely-used IANA time zone data for this purpose, so the same time zone names are also recognized by other software.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eA time zone abbreviation, for example \u003ccode class=\"literal\"\u003ePST\u003c/code\u003e. Such a specification merely defines a particular offset from UTC, in contrast to full time zone names which can imply a set of daylight savings transition rules as well. The recognized abbreviations are listed in the \u003ccode class=\"literal\"\u003epg_timezone_abbrevs\u003c/code\u003e view (see \u003ca class=\"xref\" href=\"/docs/18/view-pg-timezone-abbrevs.html\" title=\"53.33. pg_timezone_abbrevs\"\u003eSection 53.33\u003c/a\u003e). You cannot set the configuration parameters \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\"\u003eTimeZone\u003c/a\u003e or \u003ca class=\"xref\" href=\"/docs/18/runtime-config-logging.html#GUC-LOG-TIMEZONE\"\u003elog_timezone\u003c/a\u003e to a time zone abbreviation, but you can use abbreviations in date/time input values and with the \u003ccode class=\"literal\"\u003eAT TIME ZONE\u003c/code\u003e operator.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eIn addition to the timezone names and abbreviations, \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e will accept POSIX-style time zone specifications, as described in \u003ca class=\"xref\" href=\"/docs/18/datetime-posix-timezone-specs.html\" title=\"B.5. POSIX Time Zone Specifications\"\u003eSection B.5\u003c/a\u003e. This option is not normally preferable to using a named time zone, but it may be necessary if no suitable IANA time zone entry is available.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003cp\u003eIn short, this is the difference between abbreviations and full names: abbreviations represent a specific offset from UTC, whereas many of the full names imply a local daylight-savings time rule, and so have two possible UTC offsets. As an example, \u003ccode class=\"literal\"\u003e2014-06-04 12:00 America/New_York\u003c/code\u003e represents noon local time in New York, which for this particular date was Eastern Daylight Time (UTC-4). So \u003ccode class=\"literal\"\u003e2014-06-04 12:00 EDT\u003c/code\u003e specifies that same time instant. But \u003ccode class=\"literal\"\u003e2014-06-04 12:00 EST\u003c/code\u003e specifies noon Eastern Standard Time (UTC-5), regardless of whether daylight savings was nominally in effect on that date.\u003c/p\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eThe sign in POSIX-style time zone specifications has the opposite meaning of the sign in ISO-8601 datetime values. For example, the POSIX time zone for \u003ccode class=\"literal\"\u003e2014-06-04 12:00+04\u003c/code\u003e would be UTC-4.\u003c/p\u003e\n\u003c/div\u003e\n\u003cp\u003eTo complicate matters, some jurisdictions have used the same timezone abbreviation to mean different UTC offsets at different times; for example, in Moscow \u003ccode class=\"literal\"\u003eMSK\u003c/code\u003e has meant UTC+3 in some years and UTC+4 in others. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e interprets such abbreviations according to whatever they meant (or had most recently meant) on the specified date; but, as with the \u003ccode class=\"literal\"\u003eEST\u003c/code\u003e example above, this is not necessarily the same as local civil time on that date.\u003c/p\u003e\n\u003cp\u003eIn all cases, timezone names and abbreviations are recognized case-insensitively. (This is a change from \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e versions prior to 8.2, which were case-sensitive in some contexts but not others.)\u003c/p\u003e\n\u003cp\u003eNeither timezone names nor abbreviations are hard-wired into the server; they are obtained from configuration files stored under \u003ccode class=\"filename\"\u003e.../share/timezone/\u003c/code\u003e and \u003ccode class=\"filename\"\u003e.../share/timezonesets/\u003c/code\u003e of the installation directory (see \u003ca class=\"xref\" href=\"/docs/18/datetime-config-files.html\" title=\"B.4. Date/Time Configuration Files\"\u003eSection B.4\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eThe \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\"\u003eTimeZone\u003c/a\u003e configuration parameter can be set in the file \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e, or in any of the other standard ways described in \u003ca class=\"xref\" href=\"/docs/18/runtime-config.html\" title=\"Chapter 19. Server Configuration\"\u003eChapter 19\u003c/a\u003e. There are also some special ways to set it:\u003c/p\u003e\n\u003cdiv class=\"itemizedlist\"\u003e\n\u003cul class=\"itemizedlist\"\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eThe SQL command \u003ccode class=\"command\"\u003eSET TIME ZONE\u003c/code\u003e sets the time zone for the session. This is an alternative spelling of \u003ccode class=\"command\"\u003eSET TIMEZONE TO\u003c/code\u003e with a more SQL-spec-compatible syntax.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eThe \u003ccode class=\"envar\"\u003ePGTZ\u003c/code\u003e environment variable is used by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e clients to send a \u003ccode class=\"command\"\u003eSET TIME ZONE\u003c/code\u003e command to the server upon connection.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect2\" id=\"DATATYPE-INTERVAL-INPUT\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3 class=\"title\"\u003e8.5.4. Interval Input \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ccode class=\"type\"\u003einterval\u003c/code\u003e values can be written using the following verbose syntax:\u003c/p\u003e\n\u003cpre class=\"synopsis\"\u003e[\u003cspan class=\"optional\"\u003e@\u003c/span\u003e] \u003cem class=\"replaceable\"\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e...\u003c/span\u003e] [\u003cspan class=\"optional\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edirection\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e]\n\u003c/pre\u003e\n\u003cp\u003ewhere \u003cem class=\"replaceable\"\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e is a number (possibly signed); \u003cem class=\"replaceable\"\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e is \u003ccode class=\"literal\"\u003emicrosecond\u003c/code\u003e, \u003ccode class=\"literal\"\u003emillisecond\u003c/code\u003e, \u003ccode class=\"literal\"\u003esecond\u003c/code\u003e, \u003ccode class=\"literal\"\u003eminute\u003c/code\u003e, \u003ccode class=\"literal\"\u003ehour\u003c/code\u003e, \u003ccode class=\"literal\"\u003eday\u003c/code\u003e, \u003ccode class=\"literal\"\u003eweek\u003c/code\u003e, \u003ccode class=\"literal\"\u003emonth\u003c/code\u003e, \u003ccode class=\"literal\"\u003eyear\u003c/code\u003e, \u003ccode class=\"literal\"\u003edecade\u003c/code\u003e, \u003ccode class=\"literal\"\u003ecentury\u003c/code\u003e, \u003ccode class=\"literal\"\u003emillennium\u003c/code\u003e, or abbreviations or plurals of these units; \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirection\u003c/code\u003e\u003c/em\u003e can be \u003ccode class=\"literal\"\u003eago\u003c/code\u003e or empty. The at sign (\u003ccode class=\"literal\"\u003e@\u003c/code\u003e) is optional noise. The amounts of the different units are implicitly added with appropriate sign accounting. \u003ccode class=\"literal\"\u003eago\u003c/code\u003e negates all the fields. This syntax is also used for interval output, if \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-INTERVALSTYLE\"\u003eIntervalStyle\u003c/a\u003e is set to \u003ccode class=\"literal\"\u003epostgres_verbose\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eQuantities of days, hours, minutes, and seconds can be specified without explicit unit markings. For example, \u003ccode class=\"literal\"\u003e'1 12:59:10'\u003c/code\u003e is read the same as \u003ccode class=\"literal\"\u003e'1 day 12 hours 59 min 10 sec'\u003c/code\u003e. Also, a combination of years and months can be specified with a dash; for example \u003ccode class=\"literal\"\u003e'200-10'\u003c/code\u003e is read the same as \u003ccode class=\"literal\"\u003e'200 years 10 months'\u003c/code\u003e. (These shorter forms are in fact the only ones allowed by the SQL standard, and are used for output when \u003ccode class=\"varname\"\u003eIntervalStyle\u003c/code\u003e is set to \u003ccode class=\"literal\"\u003esql_standard\u003c/code\u003e.)\u003c/p\u003e\n\u003cp\u003eInterval values can also be written as ISO 8601 time intervals, using either the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eformat with designators\u003c/span\u003e”\u003c/span\u003e of the standard's section 4.4.3.2 or the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ealternative format\u003c/span\u003e”\u003c/span\u003e of section 4.4.3.3. The format with designators looks like this:\u003c/p\u003e\n\u003cpre class=\"synopsis\"\u003eP \u003cem class=\"replaceable\"\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e ...\u003c/span\u003e] [\u003cspan class=\"optional\"\u003e T [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e ...\u003c/span\u003e]\u003c/span\u003e]\n\u003c/pre\u003e\n\u003cp\u003eThe string must start with a \u003ccode class=\"literal\"\u003eP\u003c/code\u003e, and may include a \u003ccode class=\"literal\"\u003eT\u003c/code\u003e that introduces the time-of-day units. The available unit abbreviations are given in \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-INTERVAL-ISO8601-UNITS\" title=\"Table 8.16. ISO 8601 Interval Unit Abbreviations\"\u003eTable 8.16\u003c/a\u003e. Units may be omitted, and may be specified in any order, but units smaller than a day must appear after \u003ccode class=\"literal\"\u003eT\u003c/code\u003e. In particular, the meaning of \u003ccode class=\"literal\"\u003eM\u003c/code\u003e depends on whether it is before or after \u003ccode class=\"literal\"\u003eT\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-INTERVAL-ISO8601-UNITS\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.16. ISO 8601 Interval Unit Abbreviations\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eAbbreviation\u003c/th\u003e\n\u003cth\u003eMeaning\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eY\u003c/td\u003e\n\u003ctd\u003eYears\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eM\u003c/td\u003e\n\u003ctd\u003eMonths (in the date part)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eW\u003c/td\u003e\n\u003ctd\u003eWeeks\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eD\u003c/td\u003e\n\u003ctd\u003eDays\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eH\u003c/td\u003e\n\u003ctd\u003eHours\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eM\u003c/td\u003e\n\u003ctd\u003eMinutes (in the time part)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eS\u003c/td\u003e\n\u003ctd\u003eSeconds\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cp\u003eIn the alternative format:\u003c/p\u003e\n\u003cpre class=\"synopsis\"\u003eP [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eyears\u003c/code\u003e\u003c/em\u003e-\u003cem class=\"replaceable\"\u003e\u003ccode\u003emonths\u003c/code\u003e\u003c/em\u003e-\u003cem class=\"replaceable\"\u003e\u003ccode\u003edays\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e T \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehours\u003c/code\u003e\u003c/em\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003eminutes\u003c/code\u003e\u003c/em\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e]\n\u003c/pre\u003e\n\u003cp\u003ethe string must begin with \u003ccode class=\"literal\"\u003eP\u003c/code\u003e, and a \u003ccode class=\"literal\"\u003eT\u003c/code\u003e separates the date and time parts of the interval. The values are given as numbers similar to ISO 8601 dates.\u003c/p\u003e\n\u003cp\u003eWhen writing an interval constant with a \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e specification, or when assigning a string to an interval column that was defined with a \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e specification, the interpretation of unmarked quantities depends on the \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e. For example \u003ccode class=\"literal\"\u003eINTERVAL '1' YEAR\u003c/code\u003e is read as 1 year, whereas \u003ccode class=\"literal\"\u003eINTERVAL '1'\u003c/code\u003e means 1 second. Also, field values \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eto the right\u003c/span\u003e”\u003c/span\u003e of the least significant field allowed by the \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e specification are silently discarded. For example, writing \u003ccode class=\"literal\"\u003eINTERVAL '1 day 2:03:04' HOUR TO MINUTE\u003c/code\u003e results in dropping the seconds field, but not the day field.\u003c/p\u003e\n\u003cp\u003eAccording to the SQL standard all fields of an interval value must have the same sign, so a leading negative sign applies to all fields; for example the negative sign in the interval literal \u003ccode class=\"literal\"\u003e'-1 2:03:04'\u003c/code\u003e applies to both the days and hour/minute/second parts. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e allows the fields to have different signs, and traditionally treats each field in the textual representation as independently signed, so that the hour/minute/second part is considered positive in this example. If \u003ccode class=\"varname\"\u003eIntervalStyle\u003c/code\u003e is set to \u003ccode class=\"literal\"\u003esql_standard\u003c/code\u003e then a leading sign is considered to apply to all fields (but only if no additional signs appear). Otherwise the traditional \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e interpretation is used. To avoid ambiguity, it's recommended to attach an explicit sign to each field if any field is negative.\u003c/p\u003e\n\u003cp\u003eInternally, \u003ccode class=\"type\"\u003einterval\u003c/code\u003e values are stored as three integral fields: months, days, and microseconds. These fields are kept separate because the number of days in a month varies, while a day can have 23 or 25 hours if a daylight savings time transition is involved. An interval input string that uses other units is normalized into this format, and then reconstructed in a standardized way for output, for example:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eSELECT '2 years 15 months 100 weeks 99 hours 123456789 milliseconds'::interval;\n               interval\n---------------------------------------\n 3 years 3 mons 700 days 133:17:36.789\n\u003c/pre\u003e\n\u003cp\u003eHere weeks, which are understood as \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e7 days\u003c/span\u003e”\u003c/span\u003e, have been kept separate, while the smaller and larger time units were combined and normalized.\u003c/p\u003e\n\u003cp\u003eInput field values can have fractional parts, for example \u003ccode class=\"literal\"\u003e'1.5 weeks'\u003c/code\u003e or \u003ccode class=\"literal\"\u003e'01:02:03.45'\u003c/code\u003e. However, because \u003ccode class=\"type\"\u003einterval\u003c/code\u003e internally stores only integral fields, fractional values must be converted into smaller units. Fractional parts of units greater than months are rounded to be an integer number of months, e.g. \u003ccode class=\"literal\"\u003e'1.5 years'\u003c/code\u003e becomes \u003ccode class=\"literal\"\u003e'1 year 6 mons'\u003c/code\u003e. Fractional parts of weeks and days are computed to be an integer number of days and microseconds, assuming 30 days per month and 24 hours per day, e.g., \u003ccode class=\"literal\"\u003e'1.75 months'\u003c/code\u003e becomes \u003ccode class=\"literal\"\u003e1 mon 22 days 12:00:00\u003c/code\u003e. Only seconds will ever be shown as fractional on output.\u003c/p\u003e\n\u003cp\u003e\u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-INTERVAL-INPUT-EXAMPLES\" title=\"Table 8.17. Interval Input\"\u003eTable 8.17\u003c/a\u003e shows some examples of valid \u003ccode class=\"type\"\u003einterval\u003c/code\u003e input.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-INTERVAL-INPUT-EXAMPLES\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.17. Interval Input\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e1-2\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eSQL standard format: 1 year 2 months\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e3 4:05:06\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eSQL standard format: 3 days 4 hours 5 minutes 6 seconds\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e1 year 2 months 3 days 4 hours 5 minutes 6 seconds\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eTraditional Postgres format: 1 year 2 months 3 days 4 hours 5 minutes 6 seconds\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eP1Y2M3DT4H5M6S\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601 \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eformat with designators\u003c/span\u003e”\u003c/span\u003e: same meaning as above\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eP0001-02-03T04:05:06\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601 \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ealternative format\u003c/span\u003e”\u003c/span\u003e: same meaning as above\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect2\" id=\"DATATYPE-INTERVAL-OUTPUT\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3 class=\"title\"\u003e8.5.5. Interval Output \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eAs previously explained, \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e stores \u003ccode class=\"type\"\u003einterval\u003c/code\u003e values as months, days, and microseconds. For output, the months field is converted to years and months by dividing by 12. The days field is shown as-is. The microseconds field is converted to hours, minutes, seconds, and fractional seconds. Thus months, minutes, and seconds will never be shown as exceeding the ranges 0–11, 0–59, and 0–59 respectively, while the displayed years, days, and hours fields can be quite large. (The \u003ca class=\"link\" href=\"/docs/18/functions-datetime.html#FUNCTION-JUSTIFY-DAYS\"\u003e\u003ccode class=\"function\"\u003ejustify_days\u003c/code\u003e\u003c/a\u003e and \u003ca class=\"link\" href=\"/docs/18/functions-datetime.html#FUNCTION-JUSTIFY-HOURS\"\u003e\u003ccode class=\"function\"\u003ejustify_hours\u003c/code\u003e\u003c/a\u003e functions can be used if it is desirable to transpose large days or hours values into the next higher field.)\u003c/p\u003e\n\u003cp\u003eThe output format of the interval type can be set to one of the four styles \u003ccode class=\"literal\"\u003esql_standard\u003c/code\u003e, \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e, \u003ccode class=\"literal\"\u003epostgres_verbose\u003c/code\u003e, or \u003ccode class=\"literal\"\u003eiso_8601\u003c/code\u003e, using the command \u003ccode class=\"literal\"\u003eSET intervalstyle\u003c/code\u003e. The default is the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e format. \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#INTERVAL-STYLE-OUTPUT-TABLE\" title=\"Table 8.18. Interval Output Style Examples\"\u003eTable 8.18\u003c/a\u003e shows examples of each output style.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"literal\"\u003esql_standard\u003c/code\u003e style produces output that conforms to the SQL standard's specification for interval literal strings, if the interval value meets the standard's restrictions (either year-month only or day-time only, with no mixing of positive and negative components). Otherwise the output looks like a standard year-month literal string followed by a day-time literal string, with explicit signs added to disambiguate mixed-sign intervals.\u003c/p\u003e\n\u003cp\u003eThe output of the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e style matches the output of \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e releases prior to 8.4 when the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DATESTYLE\"\u003eDateStyle\u003c/a\u003e parameter was set to \u003ccode class=\"literal\"\u003eISO\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe output of the \u003ccode class=\"literal\"\u003epostgres_verbose\u003c/code\u003e style matches the output of \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e releases prior to 8.4 when the \u003ccode class=\"varname\"\u003eDateStyle\u003c/code\u003e parameter was set to non-\u003ccode class=\"literal\"\u003eISO\u003c/code\u003e output.\u003c/p\u003e\n\u003cp\u003eThe output of the \u003ccode class=\"literal\"\u003eiso_8601\u003c/code\u003e style matches the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eformat with designators\u003c/span\u003e”\u003c/span\u003e described in section 4.4.3.2 of the ISO 8601 standard.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"INTERVAL-STYLE-OUTPUT-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.18. Interval Output Style Examples\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eStyle Specification\u003c/th\u003e\n\u003cth\u003eYear-Month Interval\u003c/th\u003e\n\u003cth\u003eDay-Time Interval\u003c/th\u003e\n\u003cth\u003eMixed Interval\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003esql_standard\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e1-2\u003c/td\u003e\n\u003ctd\u003e3 4:05:06\u003c/td\u003e\n\u003ctd\u003e-1-2 +3 -4:05:06\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e1 year 2 mons\u003c/td\u003e\n\u003ctd\u003e3 days 04:05:06\u003c/td\u003e\n\u003ctd\u003e-1 year -2 mons +3 days -04:05:06\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003epostgres_verbose\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e@ 1 year 2 mons\u003c/td\u003e\n\u003ctd\u003e@ 3 days 4 hours 5 mins 6 secs\u003c/td\u003e\n\u003ctd\u003e@ 1 year 2 mons -3 days 4 hours 5 mins 6 secs ago\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eiso_8601\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eP1Y2M\u003c/td\u003e\n\u003ctd\u003eP3DT4H5M6S\u003c/td\u003e\n\u003ctd\u003eP-1Y-2M3D​T-4H-5M-6S\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003c/div\u003e\n\u003c/div\u003e","manual_path":"datatype-datetime.html","operator_classes":[{"oid":"3127","oid_symbol":"TIMESTAMPTZ_BTREE_OPS_OID","opcdefault":"t","opcfamily":"btree/datetime_ops","opcintype":"timestamptz","opckeytype":"0","opcmethod":"btree","opcname":"timestamptz_ops","opcnamespace":"pg_catalog","opcowner":"POSTGRES"},{"opcdefault":"t","opcfamily":"hash/timestamptz_ops","opcintype":"timestamptz","opckeytype":"0","opcmethod":"hash","opcname":"timestamptz_ops","opcnamespace":"pg_catalog","opcowner":"POSTGRES"},{"opcdefault":"t","opcfamily":"brin/datetime_minmax_ops","opcintype":"timestamptz","opckeytype":"timestamptz","opcmethod":"brin","opcname":"timestamptz_minmax_ops","opcnamespace":"pg_catalog","opcowner":"POSTGRES"},{"opcdefault":"f","opcfamily":"brin/datetime_minmax_multi_ops","opcintype":"timestamptz","opckeytype":"timestamptz","opcmethod":"brin","opcname":"timestamptz_minmax_multi_ops","opcnamespace":"pg_catalog","opcowner":"POSTGRES"},{"opcdefault":"f","opcfamily":"brin/datetime_bloom_ops","opcintype":"timestamptz","opckeytype":"timestamptz","opcmethod":"brin","opcname":"timestamptz_bloom_ops","opcnamespace":"pg_catalog","opcowner":"POSTGRES"}],"operators":[{"descr":"equal","oid":"1320","oprcanhash":"t","oprcanmerge":"t","oprcode":"timestamptz_eq","oprcom":"=(timestamptz,timestamptz)","oprjoin":"eqjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"=","oprnamespace":"pg_catalog","oprnegate":"\u003c\u003e(timestamptz,timestamptz)","oprowner":"POSTGRES","oprrest":"eqsel","oprresult":"bool","oprright":"timestamptz"},{"descr":"not equal","oid":"1321","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_ne","oprcom":"\u003c\u003e(timestamptz,timestamptz)","oprjoin":"neqjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c\u003e","oprnamespace":"pg_catalog","oprnegate":"=(timestamptz,timestamptz)","oprowner":"POSTGRES","oprrest":"neqsel","oprresult":"bool","oprright":"timestamptz"},{"descr":"less than","oid":"1322","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_lt","oprcom":"\u003e(timestamptz,timestamptz)","oprjoin":"scalarltjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c","oprnamespace":"pg_catalog","oprnegate":"\u003e=(timestamptz,timestamptz)","oprowner":"POSTGRES","oprrest":"scalarltsel","oprresult":"bool","oprright":"timestamptz"},{"descr":"less than or equal","oid":"1323","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_le","oprcom":"\u003e=(timestamptz,timestamptz)","oprjoin":"scalarlejoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c=","oprnamespace":"pg_catalog","oprnegate":"\u003e(timestamptz,timestamptz)","oprowner":"POSTGRES","oprrest":"scalarlesel","oprresult":"bool","oprright":"timestamptz"},{"descr":"greater than","oid":"1324","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_gt","oprcom":"\u003c(timestamptz,timestamptz)","oprjoin":"scalargtjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003e","oprnamespace":"pg_catalog","oprnegate":"\u003c=(timestamptz,timestamptz)","oprowner":"POSTGRES","oprrest":"scalargtsel","oprresult":"bool","oprright":"timestamptz"},{"descr":"greater than or equal","oid":"1325","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_ge","oprcom":"\u003c=(timestamptz,timestamptz)","oprjoin":"scalargejoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003e=","oprnamespace":"pg_catalog","oprnegate":"\u003c(timestamptz,timestamptz)","oprowner":"POSTGRES","oprrest":"scalargesel","oprresult":"bool","oprright":"timestamptz"},{"descr":"add","oid":"1327","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_pl_interval","oprcom":"+(interval,timestamptz)","oprjoin":"-","oprkind":"b","oprleft":"timestamptz","oprname":"+","oprnamespace":"pg_catalog","oprnegate":"0","oprowner":"POSTGRES","oprrest":"-","oprresult":"timestamptz","oprright":"interval"},{"descr":"subtract","oid":"1328","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_mi","oprcom":"0","oprjoin":"-","oprkind":"b","oprleft":"timestamptz","oprname":"-","oprnamespace":"pg_catalog","oprnegate":"0","oprowner":"POSTGRES","oprrest":"-","oprresult":"interval","oprright":"timestamptz"},{"descr":"subtract","oid":"1329","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_mi_interval","oprcom":"0","oprjoin":"-","oprkind":"b","oprleft":"timestamptz","oprname":"-","oprnamespace":"pg_catalog","oprnegate":"0","oprowner":"POSTGRES","oprrest":"-","oprresult":"timestamptz","oprright":"interval"},{"descr":"less than","oid":"2358","oprcanhash":"f","oprcanmerge":"f","oprcode":"date_lt_timestamptz","oprcom":"\u003e(timestamptz,date)","oprjoin":"scalarltjoinsel","oprkind":"b","oprleft":"date","oprname":"\u003c","oprnamespace":"pg_catalog","oprnegate":"\u003e=(date,timestamptz)","oprowner":"POSTGRES","oprrest":"scalarltsel","oprresult":"bool","oprright":"timestamptz"},{"descr":"less than or equal","oid":"2359","oprcanhash":"f","oprcanmerge":"f","oprcode":"date_le_timestamptz","oprcom":"\u003e=(timestamptz,date)","oprjoin":"scalarlejoinsel","oprkind":"b","oprleft":"date","oprname":"\u003c=","oprnamespace":"pg_catalog","oprnegate":"\u003e(date,timestamptz)","oprowner":"POSTGRES","oprrest":"scalarlesel","oprresult":"bool","oprright":"timestamptz"},{"descr":"equal","oid":"2360","oprcanhash":"f","oprcanmerge":"t","oprcode":"date_eq_timestamptz","oprcom":"=(timestamptz,date)","oprjoin":"eqjoinsel","oprkind":"b","oprleft":"date","oprname":"=","oprnamespace":"pg_catalog","oprnegate":"\u003c\u003e(date,timestamptz)","oprowner":"POSTGRES","oprrest":"eqsel","oprresult":"bool","oprright":"timestamptz"},{"descr":"greater than or equal","oid":"2361","oprcanhash":"f","oprcanmerge":"f","oprcode":"date_ge_timestamptz","oprcom":"\u003c=(timestamptz,date)","oprjoin":"scalargejoinsel","oprkind":"b","oprleft":"date","oprname":"\u003e=","oprnamespace":"pg_catalog","oprnegate":"\u003c(date,timestamptz)","oprowner":"POSTGRES","oprrest":"scalargesel","oprresult":"bool","oprright":"timestamptz"},{"descr":"greater than","oid":"2362","oprcanhash":"f","oprcanmerge":"f","oprcode":"date_gt_timestamptz","oprcom":"\u003c(timestamptz,date)","oprjoin":"scalargtjoinsel","oprkind":"b","oprleft":"date","oprname":"\u003e","oprnamespace":"pg_catalog","oprnegate":"\u003c=(date,timestamptz)","oprowner":"POSTGRES","oprrest":"scalargtsel","oprresult":"bool","oprright":"timestamptz"},{"descr":"not equal","oid":"2363","oprcanhash":"f","oprcanmerge":"f","oprcode":"date_ne_timestamptz","oprcom":"\u003c\u003e(timestamptz,date)","oprjoin":"neqjoinsel","oprkind":"b","oprleft":"date","oprname":"\u003c\u003e","oprnamespace":"pg_catalog","oprnegate":"=(date,timestamptz)","oprowner":"POSTGRES","oprrest":"neqsel","oprresult":"bool","oprright":"timestamptz"},{"descr":"less than","oid":"2384","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_lt_date","oprcom":"\u003e(date,timestamptz)","oprjoin":"scalarltjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c","oprnamespace":"pg_catalog","oprnegate":"\u003e=(timestamptz,date)","oprowner":"POSTGRES","oprrest":"scalarltsel","oprresult":"bool","oprright":"date"},{"descr":"less than or equal","oid":"2385","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_le_date","oprcom":"\u003e=(date,timestamptz)","oprjoin":"scalarlejoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c=","oprnamespace":"pg_catalog","oprnegate":"\u003e(timestamptz,date)","oprowner":"POSTGRES","oprrest":"scalarlesel","oprresult":"bool","oprright":"date"},{"descr":"equal","oid":"2386","oprcanhash":"f","oprcanmerge":"t","oprcode":"timestamptz_eq_date","oprcom":"=(date,timestamptz)","oprjoin":"eqjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"=","oprnamespace":"pg_catalog","oprnegate":"\u003c\u003e(timestamptz,date)","oprowner":"POSTGRES","oprrest":"eqsel","oprresult":"bool","oprright":"date"},{"descr":"greater than or equal","oid":"2387","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_ge_date","oprcom":"\u003c=(date,timestamptz)","oprjoin":"scalargejoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003e=","oprnamespace":"pg_catalog","oprnegate":"\u003c(timestamptz,date)","oprowner":"POSTGRES","oprrest":"scalargesel","oprresult":"bool","oprright":"date"},{"descr":"greater than","oid":"2388","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_gt_date","oprcom":"\u003c(date,timestamptz)","oprjoin":"scalargtjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003e","oprnamespace":"pg_catalog","oprnegate":"\u003c=(timestamptz,date)","oprowner":"POSTGRES","oprrest":"scalargtsel","oprresult":"bool","oprright":"date"},{"descr":"not equal","oid":"2389","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_ne_date","oprcom":"\u003c\u003e(date,timestamptz)","oprjoin":"neqjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c\u003e","oprnamespace":"pg_catalog","oprnegate":"=(timestamptz,date)","oprowner":"POSTGRES","oprrest":"neqsel","oprresult":"bool","oprright":"date"},{"descr":"less than","oid":"2534","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamp_lt_timestamptz","oprcom":"\u003e(timestamptz,timestamp)","oprjoin":"scalarltjoinsel","oprkind":"b","oprleft":"timestamp","oprname":"\u003c","oprnamespace":"pg_catalog","oprnegate":"\u003e=(timestamp,timestamptz)","oprowner":"POSTGRES","oprrest":"scalarltsel","oprresult":"bool","oprright":"timestamptz"},{"descr":"less than or equal","oid":"2535","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamp_le_timestamptz","oprcom":"\u003e=(timestamptz,timestamp)","oprjoin":"scalarlejoinsel","oprkind":"b","oprleft":"timestamp","oprname":"\u003c=","oprnamespace":"pg_catalog","oprnegate":"\u003e(timestamp,timestamptz)","oprowner":"POSTGRES","oprrest":"scalarlesel","oprresult":"bool","oprright":"timestamptz"},{"descr":"equal","oid":"2536","oprcanhash":"f","oprcanmerge":"t","oprcode":"timestamp_eq_timestamptz","oprcom":"=(timestamptz,timestamp)","oprjoin":"eqjoinsel","oprkind":"b","oprleft":"timestamp","oprname":"=","oprnamespace":"pg_catalog","oprnegate":"\u003c\u003e(timestamp,timestamptz)","oprowner":"POSTGRES","oprrest":"eqsel","oprresult":"bool","oprright":"timestamptz"},{"descr":"greater than or equal","oid":"2537","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamp_ge_timestamptz","oprcom":"\u003c=(timestamptz,timestamp)","oprjoin":"scalargejoinsel","oprkind":"b","oprleft":"timestamp","oprname":"\u003e=","oprnamespace":"pg_catalog","oprnegate":"\u003c(timestamp,timestamptz)","oprowner":"POSTGRES","oprrest":"scalargesel","oprresult":"bool","oprright":"timestamptz"},{"descr":"greater than","oid":"2538","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamp_gt_timestamptz","oprcom":"\u003c(timestamptz,timestamp)","oprjoin":"scalargtjoinsel","oprkind":"b","oprleft":"timestamp","oprname":"\u003e","oprnamespace":"pg_catalog","oprnegate":"\u003c=(timestamp,timestamptz)","oprowner":"POSTGRES","oprrest":"scalargtsel","oprresult":"bool","oprright":"timestamptz"},{"descr":"not equal","oid":"2539","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamp_ne_timestamptz","oprcom":"\u003c\u003e(timestamptz,timestamp)","oprjoin":"neqjoinsel","oprkind":"b","oprleft":"timestamp","oprname":"\u003c\u003e","oprnamespace":"pg_catalog","oprnegate":"=(timestamp,timestamptz)","oprowner":"POSTGRES","oprrest":"neqsel","oprresult":"bool","oprright":"timestamptz"},{"descr":"less than","oid":"2540","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_lt_timestamp","oprcom":"\u003e(timestamp,timestamptz)","oprjoin":"scalarltjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c","oprnamespace":"pg_catalog","oprnegate":"\u003e=(timestamptz,timestamp)","oprowner":"POSTGRES","oprrest":"scalarltsel","oprresult":"bool","oprright":"timestamp"},{"descr":"less than or equal","oid":"2541","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_le_timestamp","oprcom":"\u003e=(timestamp,timestamptz)","oprjoin":"scalarlejoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c=","oprnamespace":"pg_catalog","oprnegate":"\u003e(timestamptz,timestamp)","oprowner":"POSTGRES","oprrest":"scalarlesel","oprresult":"bool","oprright":"timestamp"},{"descr":"equal","oid":"2542","oprcanhash":"f","oprcanmerge":"t","oprcode":"timestamptz_eq_timestamp","oprcom":"=(timestamp,timestamptz)","oprjoin":"eqjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"=","oprnamespace":"pg_catalog","oprnegate":"\u003c\u003e(timestamptz,timestamp)","oprowner":"POSTGRES","oprrest":"eqsel","oprresult":"bool","oprright":"timestamp"},{"descr":"greater than or equal","oid":"2543","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_ge_timestamp","oprcom":"\u003c=(timestamp,timestamptz)","oprjoin":"scalargejoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003e=","oprnamespace":"pg_catalog","oprnegate":"\u003c(timestamptz,timestamp)","oprowner":"POSTGRES","oprrest":"scalargesel","oprresult":"bool","oprright":"timestamp"},{"descr":"greater than","oid":"2544","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_gt_timestamp","oprcom":"\u003c(timestamp,timestamptz)","oprjoin":"scalargtjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003e","oprnamespace":"pg_catalog","oprnegate":"\u003c=(timestamptz,timestamp)","oprowner":"POSTGRES","oprrest":"scalargtsel","oprresult":"bool","oprright":"timestamp"},{"descr":"not equal","oid":"2545","oprcanhash":"f","oprcanmerge":"f","oprcode":"timestamptz_ne_timestamp","oprcom":"\u003c\u003e(timestamp,timestamptz)","oprjoin":"neqjoinsel","oprkind":"b","oprleft":"timestamptz","oprname":"\u003c\u003e","oprnamespace":"pg_catalog","oprnegate":"=(timestamptz,timestamp)","oprowner":"POSTGRES","oprrest":"neqsel","oprresult":"bool","oprright":"timestamp"},{"descr":"add","oid":"2554","oprcanhash":"f","oprcanmerge":"f","oprcode":"interval_pl_timestamptz","oprcom":"+(timestamptz,interval)","oprjoin":"-","oprkind":"b","oprleft":"interval","oprname":"+","oprnamespace":"pg_catalog","oprnegate":"0","oprowner":"POSTGRES","oprrest":"-","oprresult":"timestamptz","oprright":"timestamptz"}],"ranges":[],"related":[{"label":"pg_type catalog","url":"/wiki/catalog/pg_type/?v=18"},{"label":"pg_cast catalog","url":"/wiki/catalog/pg_cast/?v=18"},{"label":"pg_operator catalog","url":"/wiki/catalog/pg_operator/?v=18"},{"label":"pg_opclass catalog","url":"/wiki/catalog/pg_opclass/?v=18"},{"label":"Arrays","url":"/wiki/type/arrays/?v=18"},{"label":"brin index access method","url":"/wiki/indexam/brin/?v=18"},{"label":"btree index access method","url":"/wiki/indexam/btree/?v=18"},{"label":"hash index access method","url":"/wiki/indexam/hash/?v=18"}],"release":{"channel":"stable","label":"18.6","major":"18","manual_sha256":{"arrays.html":"0e1d5c5a7b4a949d4439995f44f74ad4264e050d16eb9ad2a850fbaee04032df","catalog-pg-type.html":"ea9c9313bab8e92a7da18ebc50c7ff1f908dd80999a7e0ca3bbc82ba626c58d4","datatype-binary.html":"0c03ec47b76e37888a3da7f5dcfd340128a5d356642a85185cc9ebe17856a904","datatype-bit.html":"c49124aad561636c18080b9e09572fde7785a6b9eae86f5a33283f0fd6774c37","datatype-boolean.html":"b633f663e6c8276e7056287640c413aa79dbc15d5353cee0d41653d58d376956","datatype-character.html":"c73eebe413ea709a7792e4cfc3cfe9fb68cb496ebe83c3ebaa9d09f8c40d0f73","datatype-datetime.html":"e366275d8b13845bfa4ef0d68faa093e5f3ecb708a1ec870cbcbf7e425b85699","datatype-enum.html":"cab38e53222e30cc94b24de4b33634fd22d7c93f58ebcf35f646c9b8da78fae8","datatype-geometric.html":"0eb3053cfe7d6b0a4b5592c5d7af8d97cae527e87f063c5793413bcba5c14cd9","datatype-json.html":"650162a05b660146b500a205d523374d00aee117a6a6240d30262be51b6e33e5","datatype-money.html":"8b29c14b90679683ac5c472b59a0a7e2853f32cc7db43fab417b2697a6879964","datatype-net-types.html":"96846e641cc37727ddcd8b8a1aa0dbe33cd9787760a2b4efb0dcb9403d5be63f","datatype-numeric.html":"b74619f7ac2f1ca9f85c48073df78c33dd30e464e61baba6008634534edcb500","datatype-oid.html":"8b3360302225f08ae72716ce1804596de95b568e5d31f788cb4597427b28cc38","datatype-pg-lsn.html":"339172f5107cc7eb7139bec911277647219e92a532cebd0f3da0a5dacf8195af","datatype-pseudo.html":"c7cf0b8214304bd8702c95f2142671ae5f0d631f83717f9c07d9e1f2579961b4","datatype-textsearch.html":"4b15e05be8b49a71b28aea22f2c46d0dbf639a91e7b4fe129a4c737c6daad47c","datatype-uuid.html":"292b307b3223c6182bdba687e7f69e6dca9038430143ad79d56327f6ed4c3246","datatype-xml.html":"061fc2295b7b69be704f0a741b8decd10ad721059f871fb0243c669bb54d7822","datatype.html":"e581f67c74e42006289638c8659e9b338adbfd7f068bd8bf2b3be3880fcd2254","domains.html":"82d486973ccc35d14276627a67ac76b434452f23f9ed4d8aa3fbb01fdf285fc2","functions-info.html":"78ac80bf81da2e4f4a33f3b850faa86f0f58ec54a083d6c31da557907de0df87","rangetypes.html":"e4960abc7ce8e51d794f94f1e57b099d30b7f75dd7f2b23a960eef91f6291c33","rowtypes.html":"74f99e029c3a9edfd3e18810ba3c8cb66d3aada91eb67b86476560871e6617e9","sql-createdomain.html":"e94f927196de1b0ea1ce35cd4603c1f6f544439adcc0edf1c4222358e832245b"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_files":{"doc/src/sgml/datatype.sgml":"86328daa77e20d81d222376ec0306d9841a17104e436c08d138eb763aefb3700","src/include/catalog/pg_am.dat":"b3cb86b102a42fb0024cbd99779c9897afb40d12a71f5cc5a0e5aee7ff2f9969","src/include/catalog/pg_am.h":"3426799df799f32163fcc0765f43dbdb5e88e626acf31284fef9fc6014b69d8e","src/include/catalog/pg_cast.dat":"97911281ca2c81917394ccb2ec13367e37c6801fd461d5e1a3d2f28b911b46b2","src/include/catalog/pg_cast.h":"de585c7df687d698e7d1d100dce8a794ac9da52414ea48169191019178c8f053","src/include/catalog/pg_opclass.dat":"4ee7d3619a6aa106e1c0db55de903931c7d11b1c60ba053a022519c55f8ee668","src/include/catalog/pg_opclass.h":"9c218537806c8ef0398302faaca7f91315dfc1198c48706cebffb479b68defaf","src/include/catalog/pg_operator.dat":"5d35b9b2ef5f9797cc815263927ef8a12367fedace53e828b4e8b320e2a7f703","src/include/catalog/pg_operator.h":"621b18cfffe102413d79b746ce7a10f77fc60fdd097bac34c22b31070d3ee3c4","src/include/catalog/pg_opfamily.dat":"3b694879027b858f2ecf1fa1152b7e30c6e15a216ba99c2384291c30e9d52311","src/include/catalog/pg_opfamily.h":"e1f5fc8aebd3042df847455bf66bf755f768c2aa8a9b03d22f7ec8563eba59c0","src/include/catalog/pg_proc.dat":"1f934ce80d460159dda137714374a35f9896315ea2476709cbb4da13b38ef95a","src/include/catalog/pg_proc.h":"f7d59f07c5b95e2f3c7141762a0f576e8a3af7581ba54c27537f4d500472bea5","src/include/catalog/pg_range.dat":"5c2271f8e89e9378d1887204e5785060b77405b5f0ff3e6c719250c9c1dcfcc4","src/include/catalog/pg_range.h":"45546d952b5181f989bd9234721897fc2b37005c8e49ce2ddc156f26974c3ca4","src/include/catalog/pg_type.dat":"5f5887b75677cba2d4a1a0cfeb355df5ed91f85d385fac88bd8d7c605b3578f9","src/include/catalog/pg_type.h":"8fb198749fd82b6c1818a3c18455f226f66116fcfeb3d4959c65ce3fda22802e"},"source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[],"signature":"timestamp [ ( p ) ] with time zone","sources":[{"label":"PostgreSQL 18 English manual","path":"datatype-datetime.html","sha256":"e366275d8b13845bfa4ef0d68faa093e5f3ecb708a1ec870cbcbf7e425b85699","url":"/docs/18/datatype-datetime.html"},{"label":"Matching PostgreSQL source archive","sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"}]},"ManualEvidence":{"manual_path":"datatype-datetime.html","release":{"channel":"stable","label":"18.6","major":"18","manual_sha256":{"arrays.html":"0e1d5c5a7b4a949d4439995f44f74ad4264e050d16eb9ad2a850fbaee04032df","catalog-pg-type.html":"ea9c9313bab8e92a7da18ebc50c7ff1f908dd80999a7e0ca3bbc82ba626c58d4","datatype-binary.html":"0c03ec47b76e37888a3da7f5dcfd340128a5d356642a85185cc9ebe17856a904","datatype-bit.html":"c49124aad561636c18080b9e09572fde7785a6b9eae86f5a33283f0fd6774c37","datatype-boolean.html":"b633f663e6c8276e7056287640c413aa79dbc15d5353cee0d41653d58d376956","datatype-character.html":"c73eebe413ea709a7792e4cfc3cfe9fb68cb496ebe83c3ebaa9d09f8c40d0f73","datatype-datetime.html":"e366275d8b13845bfa4ef0d68faa093e5f3ecb708a1ec870cbcbf7e425b85699","datatype-enum.html":"cab38e53222e30cc94b24de4b33634fd22d7c93f58ebcf35f646c9b8da78fae8","datatype-geometric.html":"0eb3053cfe7d6b0a4b5592c5d7af8d97cae527e87f063c5793413bcba5c14cd9","datatype-json.html":"650162a05b660146b500a205d523374d00aee117a6a6240d30262be51b6e33e5","datatype-money.html":"8b29c14b90679683ac5c472b59a0a7e2853f32cc7db43fab417b2697a6879964","datatype-net-types.html":"96846e641cc37727ddcd8b8a1aa0dbe33cd9787760a2b4efb0dcb9403d5be63f","datatype-numeric.html":"b74619f7ac2f1ca9f85c48073df78c33dd30e464e61baba6008634534edcb500","datatype-oid.html":"8b3360302225f08ae72716ce1804596de95b568e5d31f788cb4597427b28cc38","datatype-pg-lsn.html":"339172f5107cc7eb7139bec911277647219e92a532cebd0f3da0a5dacf8195af","datatype-pseudo.html":"c7cf0b8214304bd8702c95f2142671ae5f0d631f83717f9c07d9e1f2579961b4","datatype-textsearch.html":"4b15e05be8b49a71b28aea22f2c46d0dbf639a91e7b4fe129a4c737c6daad47c","datatype-uuid.html":"292b307b3223c6182bdba687e7f69e6dca9038430143ad79d56327f6ed4c3246","datatype-xml.html":"061fc2295b7b69be704f0a741b8decd10ad721059f871fb0243c669bb54d7822","datatype.html":"e581f67c74e42006289638c8659e9b338adbfd7f068bd8bf2b3be3880fcd2254","domains.html":"82d486973ccc35d14276627a67ac76b434452f23f9ed4d8aa3fbb01fdf285fc2","functions-info.html":"78ac80bf81da2e4f4a33f3b850faa86f0f58ec54a083d6c31da557907de0df87","rangetypes.html":"e4960abc7ce8e51d794f94f1e57b099d30b7f75dd7f2b23a960eef91f6291c33","rowtypes.html":"74f99e029c3a9edfd3e18810ba3c8cb66d3aada91eb67b86476560871e6617e9","sql-createdomain.html":"e94f927196de1b0ea1ce35cd4603c1f6f544439adcc0edf1c4222358e832245b"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_files":{"doc/src/sgml/datatype.sgml":"86328daa77e20d81d222376ec0306d9841a17104e436c08d138eb763aefb3700","src/include/catalog/pg_am.dat":"b3cb86b102a42fb0024cbd99779c9897afb40d12a71f5cc5a0e5aee7ff2f9969","src/include/catalog/pg_am.h":"3426799df799f32163fcc0765f43dbdb5e88e626acf31284fef9fc6014b69d8e","src/include/catalog/pg_cast.dat":"97911281ca2c81917394ccb2ec13367e37c6801fd461d5e1a3d2f28b911b46b2","src/include/catalog/pg_cast.h":"de585c7df687d698e7d1d100dce8a794ac9da52414ea48169191019178c8f053","src/include/catalog/pg_opclass.dat":"4ee7d3619a6aa106e1c0db55de903931c7d11b1c60ba053a022519c55f8ee668","src/include/catalog/pg_opclass.h":"9c218537806c8ef0398302faaca7f91315dfc1198c48706cebffb479b68defaf","src/include/catalog/pg_operator.dat":"5d35b9b2ef5f9797cc815263927ef8a12367fedace53e828b4e8b320e2a7f703","src/include/catalog/pg_operator.h":"621b18cfffe102413d79b746ce7a10f77fc60fdd097bac34c22b31070d3ee3c4","src/include/catalog/pg_opfamily.dat":"3b694879027b858f2ecf1fa1152b7e30c6e15a216ba99c2384291c30e9d52311","src/include/catalog/pg_opfamily.h":"e1f5fc8aebd3042df847455bf66bf755f768c2aa8a9b03d22f7ec8563eba59c0","src/include/catalog/pg_proc.dat":"1f934ce80d460159dda137714374a35f9896315ea2476709cbb4da13b38ef95a","src/include/catalog/pg_proc.h":"f7d59f07c5b95e2f3c7141762a0f576e8a3af7581ba54c27537f4d500472bea5","src/include/catalog/pg_range.dat":"5c2271f8e89e9378d1887204e5785060b77405b5f0ff3e6c719250c9c1dcfcc4","src/include/catalog/pg_range.h":"45546d952b5181f989bd9234721897fc2b37005c8e49ce2ddc156f26974c3ca4","src/include/catalog/pg_type.dat":"5f5887b75677cba2d4a1a0cfeb355df5ed91f85d385fac88bd8d7c605b3578f9","src/include/catalog/pg_type.h":"8fb198749fd82b6c1818a3c18455f226f66116fcfeb3d4959c65ce3fda22802e"},"source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"label":"PostgreSQL 18 English manual","path":"datatype-datetime.html","sha256":"e366275d8b13845bfa4ef0d68faa093e5f3ecb708a1ec870cbcbf7e425b85699","url":"/docs/18/datatype-datetime.html"},{"label":"Matching PostgreSQL source archive","sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"}]},"MeasuredEvidence":{}},"Text":{"Collection":"type","Key":"timestamptz","SourceDatabase":"center","Version":"18","Locale":"en","Title":"timestamp with time zone","Summary":"date and time, including time zone","BodyHTML":"\u003cdiv id=\"DATATYPE-DATETIME\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch2\u003e8.5. Date/Time Types \u003c/h2\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003cp\u003e\u003cspan\u003ePostgreSQL\u003c/span\u003e supports the full set of SQL date and time types, shown in \u003ca href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-TABLE\" rel=\"nofollow\"\u003eTable 8.9\u003c/a\u003e. The operations available on these data types are described in \u003ca href=\"/docs/18/functions-datetime.html\" rel=\"nofollow\"\u003eSection 9.9\u003c/a\u003e. Dates are counted according to the Gregorian calendar, even in years before that calendar was introduced (see \u003ca href=\"/docs/18/datetime-units-history.html\" rel=\"nofollow\"\u003eSection B.6\u003c/a\u003e for more information).\u003c/p\u003e\n\u003cdiv id=\"DATATYPE-DATETIME-TABLE\"\u003e\n\u003cp\u003e\u003cstrong\u003eTable 8.9. Date/Time Types\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n\u003ctable\u003e\n\n\n\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eName\u003c/th\u003e\n\u003cth\u003eStorage Size\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003cth\u003eLow Value\u003c/th\u003e\n\u003cth\u003eHigh Value\u003c/th\u003e\n\u003cth\u003eResolution\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003etimestamp [ (\u003cem\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] [ without time zone ]\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e8 bytes\u003c/td\u003e\n\u003ctd\u003eboth date and time (no time zone)\u003c/td\u003e\n\u003ctd\u003e4713 BC\u003c/td\u003e\n\u003ctd\u003e294276 AD\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003etimestamp [ (\u003cem\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] with time zone\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e8 bytes\u003c/td\u003e\n\u003ctd\u003eboth date and time, with time zone\u003c/td\u003e\n\u003ctd\u003e4713 BC\u003c/td\u003e\n\u003ctd\u003e294276 AD\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003edate\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e4 bytes\u003c/td\u003e\n\u003ctd\u003edate (no time of day)\u003c/td\u003e\n\u003ctd\u003e4713 BC\u003c/td\u003e\n\u003ctd\u003e5874897 AD\u003c/td\u003e\n\u003ctd\u003e1 day\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003etime [ (\u003cem\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] [ without time zone ]\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e8 bytes\u003c/td\u003e\n\u003ctd\u003etime of day (no date)\u003c/td\u003e\n\u003ctd\u003e00:00:00\u003c/td\u003e\n\u003ctd\u003e24:00:00\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003etime [ (\u003cem\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] with time zone\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e12 bytes\u003c/td\u003e\n\u003ctd\u003etime of day (no date), with time zone\u003c/td\u003e\n\u003ctd\u003e00:00:00+1559\u003c/td\u003e\n\u003ctd\u003e24:00:00-1559\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003einterval [ \u003cem\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e ] [ (\u003cem\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ]\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e16 bytes\u003c/td\u003e\n\u003ctd\u003etime interval\u003c/td\u003e\n\u003ctd\u003e-178000000 years\u003c/td\u003e\n\u003ctd\u003e178000000 years\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr\u003e\n\u003cdiv\u003e\n\u003ch3\u003eNote\u003c/h3\u003e\n\u003cp\u003eThe SQL standard requires that writing just \u003ccode\u003etimestamp\u003c/code\u003e be equivalent to \u003ccode\u003etimestamp without time zone\u003c/code\u003e, and \u003cspan\u003ePostgreSQL\u003c/span\u003e honors that behavior. \u003ccode\u003etimestamptz\u003c/code\u003e is accepted as an abbreviation for \u003ccode\u003etimestamp with time zone\u003c/code\u003e; this is a \u003cspan\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ccode\u003etime\u003c/code\u003e, \u003ccode\u003etimestamp\u003c/code\u003e, and \u003ccode\u003einterval\u003c/code\u003e accept an optional precision value \u003cem\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e which specifies the number of fractional digits retained in the seconds field. By default, there is no explicit bound on precision. The allowed range of \u003cem\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e is from 0 to 6.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003einterval\u003c/code\u003e type has an additional option, which is to restrict the set of stored fields by writing one of these phrases:\u003c/p\u003e\n\u003cpre\u003eYEAR\nMONTH\nDAY\nHOUR\nMINUTE\nSECOND\nYEAR TO MONTH\nDAY TO HOUR\nDAY TO MINUTE\nDAY TO SECOND\nHOUR TO MINUTE\nHOUR TO SECOND\nMINUTE TO SECOND\n\u003c/pre\u003e\n\u003cp\u003eNote that if both \u003cem\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e and \u003cem\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e are specified, the \u003cem\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e must include \u003ccode\u003eSECOND\u003c/code\u003e, since the precision applies only to the seconds.\u003c/p\u003e\n\u003cp\u003eThe type \u003ccode\u003etime with time zone\u003c/code\u003e is defined by the SQL standard, but the definition exhibits properties which lead to questionable usefulness. In most cases, a combination of \u003ccode\u003edate\u003c/code\u003e, \u003ccode\u003etime\u003c/code\u003e, \u003ccode\u003etimestamp without time zone\u003c/code\u003e, and \u003ccode\u003etimestamp with time zone\u003c/code\u003e should provide a complete range of date/time functionality required by any application.\u003c/p\u003e\n\u003cdiv id=\"DATATYPE-DATETIME-INPUT\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3\u003e8.5.1. Date/Time Input \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eDate and time input is accepted in almost any reasonable format, including ISO 8601, SQL-compatible, traditional \u003cspan\u003ePOSTGRES\u003c/span\u003e, and others. For some formats, ordering of day, month, and year in date input is ambiguous and there is support for specifying the expected ordering of these fields. Set the \u003ca href=\"/docs/18/runtime-config-client.html#GUC-DATESTYLE\" rel=\"nofollow\"\u003eDateStyle\u003c/a\u003e parameter to \u003ccode\u003eMDY\u003c/code\u003e to select month-day-year interpretation, \u003ccode\u003eDMY\u003c/code\u003e to select day-month-year interpretation, or \u003ccode\u003eYMD\u003c/code\u003e to select year-month-day interpretation.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003ePostgreSQL\u003c/span\u003e is more flexible in handling date/time input than the SQL standard requires. See \u003ca href=\"/docs/18/datetime-appendix.html\" rel=\"nofollow\"\u003eAppendix B\u003c/a\u003e for the exact parsing rules of date/time input and for the recognized text fields including months, days of the week, and time zones.\u003c/p\u003e\n\u003cp\u003eRemember that any date or time literal input needs to be enclosed in single quotes, like text strings. Refer to \u003ca href=\"/docs/18/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-GENERIC\" rel=\"nofollow\"\u003eSection 4.1.2.7\u003c/a\u003e for more information. SQL requires the following syntax\u003c/p\u003e\n\u003cpre\u003e\u003cem\u003e\u003ccode\u003etype\u003c/code\u003e\u003c/em\u003e [ (\u003cem\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] \u0026#39;\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u0026#39;\n\u003c/pre\u003e\n\u003cp\u003ewhere \u003cem\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e is an optional precision specification giving the number of fractional digits in the seconds field. Precision can be specified for \u003ccode\u003etime\u003c/code\u003e, \u003ccode\u003etimestamp\u003c/code\u003e, and \u003ccode\u003einterval\u003c/code\u003e types, and can range from 0 to 6. If no precision is specified in a constant specification, it defaults to the precision of the literal value (but not more than 6 digits).\u003c/p\u003e\n\u003cdiv id=\"DATATYPE-DATETIME-INPUT-DATES\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch4\u003e8.5.1.1. Dates \u003c/h4\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ca href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-DATE-TABLE\" rel=\"nofollow\"\u003eTable 8.10\u003c/a\u003e shows some possible inputs for the \u003ccode\u003edate\u003c/code\u003e type.\u003c/p\u003e\n\u003cdiv id=\"DATATYPE-DATETIME-DATE-TABLE\"\u003e\n\u003cp\u003e\u003cstrong\u003eTable 8.10. Date Input\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n\u003ctable\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e1999-01-08\u003c/td\u003e\n\u003ctd\u003eISO 8601; January 8 in any mode (recommended format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJanuary 8, 1999\u003c/td\u003e\n\u003ctd\u003eunambiguous in any \u003ccode\u003edatestyle\u003c/code\u003e input mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1/8/1999\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in \u003ccode\u003eMDY\u003c/code\u003e mode; August 1 in \u003ccode\u003eDMY\u003c/code\u003e mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1/18/1999\u003c/td\u003e\n\u003ctd\u003eJanuary 18 in \u003ccode\u003eMDY\u003c/code\u003e mode; rejected in other modes\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e01/02/03\u003c/td\u003e\n\u003ctd\u003eJanuary 2, 2003 in \u003ccode\u003eMDY\u003c/code\u003e mode; February 1, 2003 in \u003ccode\u003eDMY\u003c/code\u003e mode; February 3, 2001 in \u003ccode\u003eYMD\u003c/code\u003e mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1999-Jan-08\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJan-08-1999\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e08-Jan-1999\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e99-Jan-08\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in \u003ccode\u003eYMD\u003c/code\u003e mode, else error\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e08-Jan-99\u003c/td\u003e\n\u003ctd\u003eJanuary 8, except error in \u003ccode\u003eYMD\u003c/code\u003e mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJan-08-99\u003c/td\u003e\n\u003ctd\u003eJanuary 8, except error in \u003ccode\u003eYMD\u003c/code\u003e mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e19990108\u003c/td\u003e\n\u003ctd\u003eISO 8601; January 8, 1999 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e990108\u003c/td\u003e\n\u003ctd\u003eISO 8601; January 8, 1999 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1999.008\u003c/td\u003e\n\u003ctd\u003eyear and day of year\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJ2451187\u003c/td\u003e\n\u003ctd\u003eJulian date\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJanuary 8, 99 BC\u003c/td\u003e\n\u003ctd\u003eyear 99 BC\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr\u003e\n\u003c/div\u003e\n\u003cdiv id=\"DATATYPE-DATETIME-INPUT-TIMES\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch4\u003e8.5.1.2. Times \u003c/h4\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eThe time-of-day types are \u003ccode\u003etime [ (\u003cem\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] without time zone\u003c/code\u003e and \u003ccode\u003etime [ (\u003cem\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] with time zone\u003c/code\u003e. \u003ccode\u003etime\u003c/code\u003e alone is equivalent to \u003ccode\u003etime without time zone\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eValid input for these types consists of a time of day followed by an optional time zone. (See \u003ca href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-TIME-TABLE\" rel=\"nofollow\"\u003eTable 8.11\u003c/a\u003e and \u003ca href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONE-TABLE\" rel=\"nofollow\"\u003eTable 8.12\u003c/a\u003e.) If a time zone is specified in the input for \u003ccode\u003etime without time zone\u003c/code\u003e, it is silently ignored. You can also specify a date but it will be ignored, except when you use a time zone name that involves a daylight-savings rule, such as \u003ccode\u003eAmerica/New_York\u003c/code\u003e. In this case specifying the date is required in order to determine whether standard or daylight-savings time applies. The appropriate time zone offset is recorded in the \u003ccode\u003etime with time zone\u003c/code\u003e value and is output as stored; it is not adjusted to the active time zone.\u003c/p\u003e\n\u003cdiv id=\"DATATYPE-DATETIME-TIME-TABLE\"\u003e\n\u003cp\u003e\u003cstrong\u003eTable 8.11. Time Input\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n\u003ctable\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e04:05:06.789\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e04:05:06\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e04:05\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e040506\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e04:05 AM\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003esame as 04:05; AM does not affect value\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e04:05 PM\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003esame as 16:05; input hour must be \u0026lt;= 12\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e04:05:06.789-8\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e04:05:06-08:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e04:05-08:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e040506-08\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e040506+0730\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with fractional-hour time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e040506+07:30:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset specified to seconds (not allowed in ISO 8601)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e04:05:06 PST\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003etime zone specified by abbreviation\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e2003-04-12 04:05:06 America/New_York\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003etime zone specified by full name\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr\u003e\n\u003cdiv id=\"DATATYPE-TIMEZONE-TABLE\"\u003e\n\u003cp\u003e\u003cstrong\u003eTable 8.12. Time Zone Input\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n\u003ctable\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ePST\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eAbbreviation (for Pacific Standard Time)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eAmerica/New_York\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eFull time zone name\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ePST8PDT\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003ePOSIX-style time zone specification\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e-8:00:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset for PST\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e-8:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset for PST (ISO 8601 extended format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e-800\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset for PST (ISO 8601 basic format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e-8\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset for PST (ISO 8601 basic format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ezulu\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eMilitary abbreviation for UTC\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ez\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eShort form of \u003ccode\u003ezulu\u003c/code\u003e (also in ISO 8601)\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr\u003e\n\u003cp\u003eRefer to \u003ca href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONES\" rel=\"nofollow\"\u003eSection 8.5.3\u003c/a\u003e for more information on how to specify time zones.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"DATATYPE-DATETIME-INPUT-TIME-STAMPS\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch4\u003e8.5.1.3. Time Stamps \u003c/h4\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eValid input for the time stamp types consists of the concatenation of a date and a time, followed by an optional time zone, followed by an optional \u003ccode\u003eAD\u003c/code\u003e or \u003ccode\u003eBC\u003c/code\u003e. (Alternatively, \u003ccode\u003eAD\u003c/code\u003e/\u003ccode\u003eBC\u003c/code\u003e can appear before the time zone, but this is not the preferred ordering.) Thus:\u003c/p\u003e\n\u003cpre\u003e1999-01-08 04:05:06\n\u003c/pre\u003e\n\u003cp\u003eand:\u003c/p\u003e\n\u003cpre\u003e1999-01-08 04:05:06 -8:00\n\u003c/pre\u003e\n\u003cp\u003eare valid values, which follow the ISO 8601 standard. In addition, the common format:\u003c/p\u003e\n\u003cpre\u003eJanuary 8 04:05:06 1999 PST\n\u003c/pre\u003e\n\u003cp\u003eis supported.\u003c/p\u003e\n\u003cp\u003eThe SQL standard differentiates \u003ccode\u003etimestamp without time zone\u003c/code\u003e and \u003ccode\u003etimestamp with time zone\u003c/code\u003e literals by the presence of a \u003cspan\u003e“\u003cspan\u003e+\u003c/span\u003e”\u003c/span\u003e or \u003cspan\u003e“\u003cspan\u003e-\u003c/span\u003e”\u003c/span\u003e symbol and time zone offset after the time. Hence, according to the standard,\u003c/p\u003e\n\u003cpre\u003eTIMESTAMP \u0026#39;2004-10-19 10:23:54\u0026#39;\n\u003c/pre\u003e\n\u003cp\u003eis a \u003ccode\u003etimestamp without time zone\u003c/code\u003e, while\u003c/p\u003e\n\u003cpre\u003eTIMESTAMP \u0026#39;2004-10-19 10:23:54+02\u0026#39;\n\u003c/pre\u003e\n\u003cp\u003eis a \u003ccode\u003etimestamp with time zone\u003c/code\u003e. \u003cspan\u003ePostgreSQL\u003c/span\u003e never examines the content of a literal string before determining its type, and therefore will treat both of the above as \u003ccode\u003etimestamp without time zone\u003c/code\u003e. To ensure that a literal is treated as \u003ccode\u003etimestamp with time zone\u003c/code\u003e, give it the correct explicit type:\u003c/p\u003e\n\u003cpre\u003eTIMESTAMP WITH TIME ZONE \u0026#39;2004-10-19 10:23:54+02\u0026#39;\n\u003c/pre\u003e\n\u003cp\u003eIn a value that has been determined to be \u003ccode\u003etimestamp without time zone\u003c/code\u003e, \u003cspan\u003ePostgreSQL\u003c/span\u003e will silently ignore any time zone indication. That is, the resulting value is derived from the date/time fields in the input string, and is not adjusted for time zone.\u003c/p\u003e\n\u003cp\u003eFor \u003ccode\u003etimestamp with time zone\u003c/code\u003e values, an input string that includes an explicit time zone will be converted to UTC (\u003ca href=\"/docs/18/glossary.html#GLOSSARY-UTC\" rel=\"nofollow\"\u003e\u003c/a\u003e\u003ca href=\"/docs/18/glossary.html#GLOSSARY-UTC\" title=\"UTC\" rel=\"nofollow\"\u003eUniversal Coordinated Time\u003c/a\u003e) using the appropriate offset for that time zone. If no time zone is stated in the input string, then it is assumed to be in the time zone indicated by the system\u0026#39;s \u003ca href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\" rel=\"nofollow\"\u003eTimeZone\u003c/a\u003e parameter, and is converted to UTC using the offset for the \u003ccode\u003etimezone\u003c/code\u003e zone. In either case, the value is stored internally as UTC, and the originally stated or assumed time zone is not retained.\u003c/p\u003e\n\u003cp\u003eWhen a \u003ccode\u003etimestamp with time zone\u003c/code\u003e value is output, it is always converted from UTC to the current \u003ccode\u003etimezone\u003c/code\u003e zone, and displayed as local time in that zone. To see the time in another time zone, either change \u003ccode\u003etimezone\u003c/code\u003e or use the \u003ccode\u003eAT TIME ZONE\u003c/code\u003e construct (see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT\" rel=\"nofollow\"\u003eSection 9.9.4\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eConversions between \u003ccode\u003etimestamp without time zone\u003c/code\u003e and \u003ccode\u003etimestamp with time zone\u003c/code\u003e normally assume that the \u003ccode\u003etimestamp without time zone\u003c/code\u003e value should be taken or given as \u003ccode\u003etimezone\u003c/code\u003e local time. A different time zone can be specified for the conversion using \u003ccode\u003eAT TIME ZONE\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"DATATYPE-DATETIME-SPECIAL-VALUES\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch4\u003e8.5.1.4. Special Values \u003c/h4\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003cspan\u003ePostgreSQL\u003c/span\u003e supports several special date/time input values for convenience, as shown in \u003ca href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-SPECIAL-TABLE\" rel=\"nofollow\"\u003eTable 8.13\u003c/a\u003e. The values \u003ccode\u003einfinity\u003c/code\u003e and \u003ccode\u003e-infinity\u003c/code\u003e are specially represented inside the system and will be displayed unchanged; but the others are simply notational shorthands that will be converted to ordinary date/time values when read. (In particular, \u003ccode\u003enow\u003c/code\u003e and related strings are converted to a specific time value as soon as they are read.) All of these values need to be enclosed in single quotes when used as constants in SQL commands.\u003c/p\u003e\n\u003cdiv id=\"DATATYPE-DATETIME-SPECIAL-TABLE\"\u003e\n\u003cp\u003e\u003cstrong\u003eTable 8.13. Special Date/Time Inputs\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n\u003ctable\u003e\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eInput String\u003c/th\u003e\n\u003cth\u003eValid Types\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eepoch\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003edate\u003c/code\u003e, \u003ccode\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e1970-01-01 00:00:00+00 (Unix system time zero)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003einfinity\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003edate\u003c/code\u003e, \u003ccode\u003etimestamp\u003c/code\u003e, \u003ccode\u003einterval\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003elater than all other time stamps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e-infinity\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003edate\u003c/code\u003e, \u003ccode\u003etimestamp\u003c/code\u003e, \u003ccode\u003einterval\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eearlier than all other time stamps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003enow\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003edate\u003c/code\u003e, \u003ccode\u003etime\u003c/code\u003e, \u003ccode\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003ecurrent transaction\u0026#39;s start time\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003etoday\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003edate\u003c/code\u003e, \u003ccode\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003emidnight (\u003ccode\u003e00:00\u003c/code\u003e) today\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003etomorrow\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003edate\u003c/code\u003e, \u003ccode\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003emidnight (\u003ccode\u003e00:00\u003c/code\u003e) tomorrow\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eyesterday\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003edate\u003c/code\u003e, \u003ccode\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003emidnight (\u003ccode\u003e00:00\u003c/code\u003e) yesterday\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eallballs\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003etime\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e00:00:00.00 UTC\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr\u003e\n\u003cp\u003eThe following SQL-compatible functions can also be used to obtain the current time value for the corresponding data type: \u003ccode\u003eCURRENT_DATE\u003c/code\u003e, \u003ccode\u003eCURRENT_TIME\u003c/code\u003e, \u003ccode\u003eCURRENT_TIMESTAMP\u003c/code\u003e, \u003ccode\u003eLOCALTIME\u003c/code\u003e, \u003ccode\u003eLOCALTIMESTAMP\u003c/code\u003e. (See \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT\" rel=\"nofollow\"\u003eSection 9.9.5\u003c/a\u003e.) Note that these are SQL functions and are \u003cspan\u003e\u003cem\u003enot\u003c/em\u003e\u003c/span\u003e recognized in data input strings.\u003c/p\u003e\n\u003cdiv\u003e\n\u003ch3\u003eCaution\u003c/h3\u003e\n\u003cp\u003eWhile the input strings \u003ccode\u003enow\u003c/code\u003e, \u003ccode\u003etoday\u003c/code\u003e, \u003ccode\u003etomorrow\u003c/code\u003e, and \u003ccode\u003eyesterday\u003c/code\u003e are fine to use in interactive SQL commands, they can have surprising behavior when the command is saved to be executed later, for example in prepared statements, views, and function definitions. The string can be converted to a specific time value that continues to be used long after it becomes stale. Use one of the SQL functions instead in such contexts. For example, \u003ccode\u003eCURRENT_DATE + 1\u003c/code\u003e is safer than \u003ccode\u003e\u0026#39;tomorrow\u0026#39;::date\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"DATATYPE-DATETIME-OUTPUT\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3\u003e8.5.2. Date/Time Output \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eThe output format of the date/time types can be set to one of the four styles ISO 8601, SQL (Ingres), traditional \u003cspan\u003ePOSTGRES\u003c/span\u003e (Unix \u003cspan\u003edate\u003c/span\u003e format), or German. The default is the ISO format. (The SQL standard requires the use of the ISO 8601 format. The name of the \u003cspan\u003e“\u003cspan\u003eSQL\u003c/span\u003e”\u003c/span\u003e output format is a historical accident.) \u003ca href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT-TABLE\" rel=\"nofollow\"\u003eTable 8.14\u003c/a\u003e shows examples of each output style. The output of the \u003ccode\u003edate\u003c/code\u003e and \u003ccode\u003etime\u003c/code\u003e types is generally only the date or time part in accordance with the given examples. However, the \u003cspan\u003ePOSTGRES\u003c/span\u003e style outputs date-only values in ISO format.\u003c/p\u003e\n\u003cdiv id=\"DATATYPE-DATETIME-OUTPUT-TABLE\"\u003e\n\u003cp\u003e\u003cstrong\u003eTable 8.14. Date/Time Output Styles\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n\u003ctable\u003e\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eStyle Specification\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eISO\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, SQL standard\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e1997-12-17 07:37:16-08\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eSQL\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003etraditional style\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e12/17/1997 07:37:16.00 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ePostgres\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eoriginal style\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eWed Dec 17 07:37:16 1997 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eGerman\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eregional style\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e17.12.1997 07:37:16.00 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr\u003e\n\u003cdiv\u003e\n\u003ch3\u003eNote\u003c/h3\u003e\n\u003cp\u003eISO 8601 specifies the use of uppercase letter \u003ccode\u003eT\u003c/code\u003e to separate the date and time. \u003cspan\u003ePostgreSQL\u003c/span\u003e accepts that format on input, but on output it uses a space rather than \u003ccode\u003eT\u003c/code\u003e, as shown above. This is for readability and for consistency with \u003ca href=\"https://datatracker.ietf.org/doc/html/rfc3339\" rel=\"nofollow\"\u003eRFC 3339\u003c/a\u003e as well as some other database systems.\u003c/p\u003e\n\u003c/div\u003e\n\u003cp\u003eIn the SQL and POSTGRES styles, day appears before month if DMY field ordering has been specified, otherwise month appears before day. (See \u003ca href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-INPUT\" rel=\"nofollow\"\u003eSection 8.5.1\u003c/a\u003e for how this setting also affects interpretation of input values.) \u003ca href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT2-TABLE\" rel=\"nofollow\"\u003eTable 8.15\u003c/a\u003e shows examples.\u003c/p\u003e\n\u003cdiv id=\"DATATYPE-DATETIME-OUTPUT2-TABLE\"\u003e\n\u003cp\u003e\u003cstrong\u003eTable 8.15. Date Order Conventions\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n\u003ctable\u003e\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003e\u003ccode\u003edatestyle\u003c/code\u003e Setting\u003c/th\u003e\n\u003cth\u003eInput Ordering\u003c/th\u003e\n\u003cth\u003eExample Output\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eSQL, DMY\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cem\u003e\u003ccode\u003eday\u003c/code\u003e\u003c/em\u003e/\u003cem\u003e\u003ccode\u003emonth\u003c/code\u003e\u003c/em\u003e/\u003cem\u003e\u003ccode\u003eyear\u003c/code\u003e\u003c/em\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e17/12/1997 15:37:16.00 CET\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eSQL, MDY\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cem\u003e\u003ccode\u003emonth\u003c/code\u003e\u003c/em\u003e/\u003cem\u003e\u003ccode\u003eday\u003c/code\u003e\u003c/em\u003e/\u003cem\u003e\u003ccode\u003eyear\u003c/code\u003e\u003c/em\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e12/17/1997 07:37:16.00 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ePostgres, DMY\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cem\u003e\u003ccode\u003eday\u003c/code\u003e\u003c/em\u003e/\u003cem\u003e\u003ccode\u003emonth\u003c/code\u003e\u003c/em\u003e/\u003cem\u003e\u003ccode\u003eyear\u003c/code\u003e\u003c/em\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eWed 17 Dec 07:37:16 1997 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr\u003e\n\u003cp\u003eIn the ISO style, the time zone is always shown as a signed numeric offset from UTC, with positive sign used for zones east of Greenwich. The offset will be shown as \u003cem\u003e\u003ccode\u003ehh\u003c/code\u003e\u003c/em\u003e (hours only) if it is an integral number of hours, else as \u003cem\u003e\u003ccode\u003ehh\u003c/code\u003e\u003c/em\u003e:\u003cem\u003e\u003ccode\u003emm\u003c/code\u003e\u003c/em\u003e if it is an integral number of minutes, else as \u003cem\u003e\u003ccode\u003ehh\u003c/code\u003e\u003c/em\u003e:\u003cem\u003e\u003ccode\u003emm\u003c/code\u003e\u003c/em\u003e:\u003cem\u003e\u003ccode\u003ess\u003c/code\u003e\u003c/em\u003e. (The third case is not possible with any modern time zone standard, but it can appear when working with timestamps that predate the adoption of standardized time zones.) In the other date styles, the time zone is shown as an alphabetic abbreviation if one is in common use in the current zone. Otherwise it appears as a signed numeric offset in ISO 8601 basic format (\u003cem\u003e\u003ccode\u003ehh\u003c/code\u003e\u003c/em\u003e or \u003cem\u003e\u003ccode\u003ehhmm\u003c/code\u003e\u003c/em\u003e). The alphabetic abbreviations shown in these styles are taken from the IANA time zone database entry currently selected by the \u003ca href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\" rel=\"nofollow\"\u003eTimeZone\u003c/a\u003e run-time parameter; they are not affected by the \u003ca href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE-ABBREVIATIONS\" rel=\"nofollow\"\u003etimezone_abbreviations\u003c/a\u003e setting.\u003c/p\u003e\n\u003cp\u003eThe date/time style can be selected by the user using the \u003ccode\u003eSET datestyle\u003c/code\u003e command, the \u003ca href=\"/docs/18/runtime-config-client.html#GUC-DATESTYLE\" rel=\"nofollow\"\u003eDateStyle\u003c/a\u003e parameter in the \u003ccode\u003epostgresql.conf\u003c/code\u003e configuration file, or the \u003ccode\u003ePGDATESTYLE\u003c/code\u003e environment variable on the server or client.\u003c/p\u003e\n\u003cp\u003eThe formatting function \u003ccode\u003eto_char\u003c/code\u003e (see \u003ca href=\"/docs/18/functions-formatting.html\" rel=\"nofollow\"\u003eSection 9.8\u003c/a\u003e) is also available as a more flexible way to format date/time output.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"DATATYPE-TIMEZONES\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3\u003e8.5.3. Time Zones \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eTime zones, and time-zone conventions, are influenced by political decisions, not just earth geometry. Time zones around the world became somewhat standardized during the 1900s, but continue to be prone to arbitrary changes, particularly with respect to daylight-savings rules. \u003cspan\u003ePostgreSQL\u003c/span\u003e uses the widely-used IANA (Olson) time zone database for information about historical time zone rules. For times in the future, the assumption is that the latest known rules for a given time zone will continue to be observed indefinitely far into the future.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003ePostgreSQL\u003c/span\u003e endeavors to be compatible with the SQL standard definitions for typical usage. However, the SQL standard has an odd mix of date and time types and capabilities. Two obvious problems are:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eAlthough the \u003ccode\u003edate\u003c/code\u003e type cannot have an associated time zone, the \u003ccode\u003etime\u003c/code\u003e type can. Time zones in the real world have little meaning unless associated with a date as well as a time, since the offset can vary through the year with daylight-saving time boundaries.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eThe default time zone is specified as a constant numeric offset from UTC. It is therefore impossible to adapt to daylight-saving time when doing date/time arithmetic across DST boundaries.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003cp\u003eTo address these difficulties, we recommend using date/time types that contain both date and time when using time zones. We do \u003cspan\u003e\u003cem\u003enot\u003c/em\u003e\u003c/span\u003e recommend using the type \u003ccode\u003etime with time zone\u003c/code\u003e (though it is supported by \u003cspan\u003ePostgreSQL\u003c/span\u003e for legacy applications and for compliance with the SQL standard). \u003cspan\u003ePostgreSQL\u003c/span\u003e assumes your local time zone for any type containing only date or time.\u003c/p\u003e\n\u003cp\u003eAll timezone-aware dates and times are stored internally in UTC. They are converted to local time in the zone specified by the \u003ca href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\" rel=\"nofollow\"\u003eTimeZone\u003c/a\u003e configuration parameter before being displayed to the client.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003ePostgreSQL\u003c/span\u003e allows you to specify time zones in three different forms:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eA full time zone name, for example \u003ccode\u003eAmerica/New_York\u003c/code\u003e. The recognized time zone names are listed in the \u003ccode\u003epg_timezone_names\u003c/code\u003e view (see \u003ca href=\"/docs/18/view-pg-timezone-names.html\" rel=\"nofollow\"\u003eSection 53.34\u003c/a\u003e). \u003cspan\u003ePostgreSQL\u003c/span\u003e uses the widely-used IANA time zone data for this purpose, so the same time zone names are also recognized by other software.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eA time zone abbreviation, for example \u003ccode\u003ePST\u003c/code\u003e. Such a specification merely defines a particular offset from UTC, in contrast to full time zone names which can imply a set of daylight savings transition rules as well. The recognized abbreviations are listed in the \u003ccode\u003epg_timezone_abbrevs\u003c/code\u003e view (see \u003ca href=\"/docs/18/view-pg-timezone-abbrevs.html\" rel=\"nofollow\"\u003eSection 53.33\u003c/a\u003e). You cannot set the configuration parameters \u003ca href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\" rel=\"nofollow\"\u003eTimeZone\u003c/a\u003e or \u003ca href=\"/docs/18/runtime-config-logging.html#GUC-LOG-TIMEZONE\" rel=\"nofollow\"\u003elog_timezone\u003c/a\u003e to a time zone abbreviation, but you can use abbreviations in date/time input values and with the \u003ccode\u003eAT TIME ZONE\u003c/code\u003e operator.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eIn addition to the timezone names and abbreviations, \u003cspan\u003ePostgreSQL\u003c/span\u003e will accept POSIX-style time zone specifications, as described in \u003ca href=\"/docs/18/datetime-posix-timezone-specs.html\" rel=\"nofollow\"\u003eSection B.5\u003c/a\u003e. This option is not normally preferable to using a named time zone, but it may be necessary if no suitable IANA time zone entry is available.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003cp\u003eIn short, this is the difference between abbreviations and full names: abbreviations represent a specific offset from UTC, whereas many of the full names imply a local daylight-savings time rule, and so have two possible UTC offsets. As an example, \u003ccode\u003e2014-06-04 12:00 America/New_York\u003c/code\u003e represents noon local time in New York, which for this particular date was Eastern Daylight Time (UTC-4). So \u003ccode\u003e2014-06-04 12:00 EDT\u003c/code\u003e specifies that same time instant. But \u003ccode\u003e2014-06-04 12:00 EST\u003c/code\u003e specifies noon Eastern Standard Time (UTC-5), regardless of whether daylight savings was nominally in effect on that date.\u003c/p\u003e\n\u003cdiv\u003e\n\u003ch3\u003eNote\u003c/h3\u003e\n\u003cp\u003eThe sign in POSIX-style time zone specifications has the opposite meaning of the sign in ISO-8601 datetime values. For example, the POSIX time zone for \u003ccode\u003e2014-06-04 12:00+04\u003c/code\u003e would be UTC-4.\u003c/p\u003e\n\u003c/div\u003e\n\u003cp\u003eTo complicate matters, some jurisdictions have used the same timezone abbreviation to mean different UTC offsets at different times; for example, in Moscow \u003ccode\u003eMSK\u003c/code\u003e has meant UTC+3 in some years and UTC+4 in others. \u003cspan\u003ePostgreSQL\u003c/span\u003e interprets such abbreviations according to whatever they meant (or had most recently meant) on the specified date; but, as with the \u003ccode\u003eEST\u003c/code\u003e example above, this is not necessarily the same as local civil time on that date.\u003c/p\u003e\n\u003cp\u003eIn all cases, timezone names and abbreviations are recognized case-insensitively. (This is a change from \u003cspan\u003ePostgreSQL\u003c/span\u003e versions prior to 8.2, which were case-sensitive in some contexts but not others.)\u003c/p\u003e\n\u003cp\u003eNeither timezone names nor abbreviations are hard-wired into the server; they are obtained from configuration files stored under \u003ccode\u003e.../share/timezone/\u003c/code\u003e and \u003ccode\u003e.../share/timezonesets/\u003c/code\u003e of the installation directory (see \u003ca href=\"/docs/18/datetime-config-files.html\" rel=\"nofollow\"\u003eSection B.4\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eThe \u003ca href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\" rel=\"nofollow\"\u003eTimeZone\u003c/a\u003e configuration parameter can be set in the file \u003ccode\u003epostgresql.conf\u003c/code\u003e, or in any of the other standard ways described in \u003ca href=\"/docs/18/runtime-config.html\" rel=\"nofollow\"\u003eChapter 19\u003c/a\u003e. There are also some special ways to set it:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eThe SQL command \u003ccode\u003eSET TIME ZONE\u003c/code\u003e sets the time zone for the session. This is an alternative spelling of \u003ccode\u003eSET TIMEZONE TO\u003c/code\u003e with a more SQL-spec-compatible syntax.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eThe \u003ccode\u003ePGTZ\u003c/code\u003e environment variable is used by \u003cspan\u003elibpq\u003c/span\u003e clients to send a \u003ccode\u003eSET TIME ZONE\u003c/code\u003e command to the server upon connection.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"DATATYPE-INTERVAL-INPUT\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3\u003e8.5.4. Interval Input \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ccode\u003einterval\u003c/code\u003e values can be written using the following verbose syntax:\u003c/p\u003e\n\u003cpre\u003e[\u003cspan\u003e@\u003c/span\u003e] \u003cem\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e [\u003cspan\u003e\u003cem\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e...\u003c/span\u003e] [\u003cspan\u003e\u003cem\u003e\u003ccode\u003edirection\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e]\n\u003c/pre\u003e\n\u003cp\u003ewhere \u003cem\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e is a number (possibly signed); \u003cem\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e is \u003ccode\u003emicrosecond\u003c/code\u003e, \u003ccode\u003emillisecond\u003c/code\u003e, \u003ccode\u003esecond\u003c/code\u003e, \u003ccode\u003eminute\u003c/code\u003e, \u003ccode\u003ehour\u003c/code\u003e, \u003ccode\u003eday\u003c/code\u003e, \u003ccode\u003eweek\u003c/code\u003e, \u003ccode\u003emonth\u003c/code\u003e, \u003ccode\u003eyear\u003c/code\u003e, \u003ccode\u003edecade\u003c/code\u003e, \u003ccode\u003ecentury\u003c/code\u003e, \u003ccode\u003emillennium\u003c/code\u003e, or abbreviations or plurals of these units; \u003cem\u003e\u003ccode\u003edirection\u003c/code\u003e\u003c/em\u003e can be \u003ccode\u003eago\u003c/code\u003e or empty. The at sign (\u003ccode\u003e@\u003c/code\u003e) is optional noise. The amounts of the different units are implicitly added with appropriate sign accounting. \u003ccode\u003eago\u003c/code\u003e negates all the fields. This syntax is also used for interval output, if \u003ca href=\"/docs/18/runtime-config-client.html#GUC-INTERVALSTYLE\" rel=\"nofollow\"\u003eIntervalStyle\u003c/a\u003e is set to \u003ccode\u003epostgres_verbose\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eQuantities of days, hours, minutes, and seconds can be specified without explicit unit markings. For example, \u003ccode\u003e\u0026#39;1 12:59:10\u0026#39;\u003c/code\u003e is read the same as \u003ccode\u003e\u0026#39;1 day 12 hours 59 min 10 sec\u0026#39;\u003c/code\u003e. Also, a combination of years and months can be specified with a dash; for example \u003ccode\u003e\u0026#39;200-10\u0026#39;\u003c/code\u003e is read the same as \u003ccode\u003e\u0026#39;200 years 10 months\u0026#39;\u003c/code\u003e. (These shorter forms are in fact the only ones allowed by the SQL standard, and are used for output when \u003ccode\u003eIntervalStyle\u003c/code\u003e is set to \u003ccode\u003esql_standard\u003c/code\u003e.)\u003c/p\u003e\n\u003cp\u003eInterval values can also be written as ISO 8601 time intervals, using either the \u003cspan\u003e“\u003cspan\u003eformat with designators\u003c/span\u003e”\u003c/span\u003e of the standard\u0026#39;s section 4.4.3.2 or the \u003cspan\u003e“\u003cspan\u003ealternative format\u003c/span\u003e”\u003c/span\u003e of section 4.4.3.3. The format with designators looks like this:\u003c/p\u003e\n\u003cpre\u003eP \u003cem\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e [\u003cspan\u003e \u003cem\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e ...\u003c/span\u003e] [\u003cspan\u003e T [\u003cspan\u003e \u003cem\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e ...\u003c/span\u003e]\u003c/span\u003e]\n\u003c/pre\u003e\n\u003cp\u003eThe string must start with a \u003ccode\u003eP\u003c/code\u003e, and may include a \u003ccode\u003eT\u003c/code\u003e that introduces the time-of-day units. The available unit abbreviations are given in \u003ca href=\"/docs/18/datatype-datetime.html#DATATYPE-INTERVAL-ISO8601-UNITS\" rel=\"nofollow\"\u003eTable 8.16\u003c/a\u003e. Units may be omitted, and may be specified in any order, but units smaller than a day must appear after \u003ccode\u003eT\u003c/code\u003e. In particular, the meaning of \u003ccode\u003eM\u003c/code\u003e depends on whether it is before or after \u003ccode\u003eT\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv id=\"DATATYPE-INTERVAL-ISO8601-UNITS\"\u003e\n\u003cp\u003e\u003cstrong\u003eTable 8.16. ISO 8601 Interval Unit Abbreviations\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n\u003ctable\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eAbbreviation\u003c/th\u003e\n\u003cth\u003eMeaning\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eY\u003c/td\u003e\n\u003ctd\u003eYears\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eM\u003c/td\u003e\n\u003ctd\u003eMonths (in the date part)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eW\u003c/td\u003e\n\u003ctd\u003eWeeks\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eD\u003c/td\u003e\n\u003ctd\u003eDays\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eH\u003c/td\u003e\n\u003ctd\u003eHours\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eM\u003c/td\u003e\n\u003ctd\u003eMinutes (in the time part)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eS\u003c/td\u003e\n\u003ctd\u003eSeconds\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr\u003e\n\u003cp\u003eIn the alternative format:\u003c/p\u003e\n\u003cpre\u003eP [\u003cspan\u003e \u003cem\u003e\u003ccode\u003eyears\u003c/code\u003e\u003c/em\u003e-\u003cem\u003e\u003ccode\u003emonths\u003c/code\u003e\u003c/em\u003e-\u003cem\u003e\u003ccode\u003edays\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] [\u003cspan\u003e T \u003cem\u003e\u003ccode\u003ehours\u003c/code\u003e\u003c/em\u003e:\u003cem\u003e\u003ccode\u003eminutes\u003c/code\u003e\u003c/em\u003e:\u003cem\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e]\n\u003c/pre\u003e\n\u003cp\u003ethe string must begin with \u003ccode\u003eP\u003c/code\u003e, and a \u003ccode\u003eT\u003c/code\u003e separates the date and time parts of the interval. The values are given as numbers similar to ISO 8601 dates.\u003c/p\u003e\n\u003cp\u003eWhen writing an interval constant with a \u003cem\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e specification, or when assigning a string to an interval column that was defined with a \u003cem\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e specification, the interpretation of unmarked quantities depends on the \u003cem\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e. For example \u003ccode\u003eINTERVAL \u0026#39;1\u0026#39; YEAR\u003c/code\u003e is read as 1 year, whereas \u003ccode\u003eINTERVAL \u0026#39;1\u0026#39;\u003c/code\u003e means 1 second. Also, field values \u003cspan\u003e“\u003cspan\u003eto the right\u003c/span\u003e”\u003c/span\u003e of the least significant field allowed by the \u003cem\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e specification are silently discarded. For example, writing \u003ccode\u003eINTERVAL \u0026#39;1 day 2:03:04\u0026#39; HOUR TO MINUTE\u003c/code\u003e results in dropping the seconds field, but not the day field.\u003c/p\u003e\n\u003cp\u003eAccording to the SQL standard all fields of an interval value must have the same sign, so a leading negative sign applies to all fields; for example the negative sign in the interval literal \u003ccode\u003e\u0026#39;-1 2:03:04\u0026#39;\u003c/code\u003e applies to both the days and hour/minute/second parts. \u003cspan\u003ePostgreSQL\u003c/span\u003e allows the fields to have different signs, and traditionally treats each field in the textual representation as independently signed, so that the hour/minute/second part is considered positive in this example. If \u003ccode\u003eIntervalStyle\u003c/code\u003e is set to \u003ccode\u003esql_standard\u003c/code\u003e then a leading sign is considered to apply to all fields (but only if no additional signs appear). Otherwise the traditional \u003cspan\u003ePostgreSQL\u003c/span\u003e interpretation is used. To avoid ambiguity, it\u0026#39;s recommended to attach an explicit sign to each field if any field is negative.\u003c/p\u003e\n\u003cp\u003eInternally, \u003ccode\u003einterval\u003c/code\u003e values are stored as three integral fields: months, days, and microseconds. These fields are kept separate because the number of days in a month varies, while a day can have 23 or 25 hours if a daylight savings time transition is involved. An interval input string that uses other units is normalized into this format, and then reconstructed in a standardized way for output, for example:\u003c/p\u003e\n\u003cpre\u003eSELECT \u0026#39;2 years 15 months 100 weeks 99 hours 123456789 milliseconds\u0026#39;::interval;\n               interval\n---------------------------------------\n 3 years 3 mons 700 days 133:17:36.789\n\u003c/pre\u003e\n\u003cp\u003eHere weeks, which are understood as \u003cspan\u003e“\u003cspan\u003e7 days\u003c/span\u003e”\u003c/span\u003e, have been kept separate, while the smaller and larger time units were combined and normalized.\u003c/p\u003e\n\u003cp\u003eInput field values can have fractional parts, for example \u003ccode\u003e\u0026#39;1.5 weeks\u0026#39;\u003c/code\u003e or \u003ccode\u003e\u0026#39;01:02:03.45\u0026#39;\u003c/code\u003e. However, because \u003ccode\u003einterval\u003c/code\u003e internally stores only integral fields, fractional values must be converted into smaller units. Fractional parts of units greater than months are rounded to be an integer number of months, e.g. \u003ccode\u003e\u0026#39;1.5 years\u0026#39;\u003c/code\u003e becomes \u003ccode\u003e\u0026#39;1 year 6 mons\u0026#39;\u003c/code\u003e. Fractional parts of weeks and days are computed to be an integer number of days and microseconds, assuming 30 days per month and 24 hours per day, e.g., \u003ccode\u003e\u0026#39;1.75 months\u0026#39;\u003c/code\u003e becomes \u003ccode\u003e1 mon 22 days 12:00:00\u003c/code\u003e. Only seconds will ever be shown as fractional on output.\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"/docs/18/datatype-datetime.html#DATATYPE-INTERVAL-INPUT-EXAMPLES\" rel=\"nofollow\"\u003eTable 8.17\u003c/a\u003e shows some examples of valid \u003ccode\u003einterval\u003c/code\u003e input.\u003c/p\u003e\n\u003cdiv id=\"DATATYPE-INTERVAL-INPUT-EXAMPLES\"\u003e\n\u003cp\u003e\u003cstrong\u003eTable 8.17. Interval Input\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n\u003ctable\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e1-2\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eSQL standard format: 1 year 2 months\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e3 4:05:06\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eSQL standard format: 3 days 4 hours 5 minutes 6 seconds\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e1 year 2 months 3 days 4 hours 5 minutes 6 seconds\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eTraditional Postgres format: 1 year 2 months 3 days 4 hours 5 minutes 6 seconds\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eP1Y2M3DT4H5M6S\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601 \u003cspan\u003e“\u003cspan\u003eformat with designators\u003c/span\u003e”\u003c/span\u003e: same meaning as above\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eP0001-02-03T04:05:06\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601 \u003cspan\u003e“\u003cspan\u003ealternative format\u003c/span\u003e”\u003c/span\u003e: same meaning as above\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr\u003e\n\u003c/div\u003e\n\u003cdiv id=\"DATATYPE-INTERVAL-OUTPUT\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3\u003e8.5.5. Interval Output \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eAs previously explained, \u003cspan\u003ePostgreSQL\u003c/span\u003e stores \u003ccode\u003einterval\u003c/code\u003e values as months, days, and microseconds. For output, the months field is converted to years and months by dividing by 12. The days field is shown as-is. The microseconds field is converted to hours, minutes, seconds, and fractional seconds. Thus months, minutes, and seconds will never be shown as exceeding the ranges 0–11, 0–59, and 0–59 respectively, while the displayed years, days, and hours fields can be quite large. (The \u003ca href=\"/docs/18/functions-datetime.html#FUNCTION-JUSTIFY-DAYS\" rel=\"nofollow\"\u003e\u003ccode\u003ejustify_days\u003c/code\u003e\u003c/a\u003e and \u003ca href=\"/docs/18/functions-datetime.html#FUNCTION-JUSTIFY-HOURS\" rel=\"nofollow\"\u003e\u003ccode\u003ejustify_hours\u003c/code\u003e\u003c/a\u003e functions can be used if it is desirable to transpose large days or hours values into the next higher field.)\u003c/p\u003e\n\u003cp\u003eThe output format of the interval type can be set to one of the four styles \u003ccode\u003esql_standard\u003c/code\u003e, \u003ccode\u003epostgres\u003c/code\u003e, \u003ccode\u003epostgres_verbose\u003c/code\u003e, or \u003ccode\u003eiso_8601\u003c/code\u003e, using the command \u003ccode\u003eSET intervalstyle\u003c/code\u003e. The default is the \u003ccode\u003epostgres\u003c/code\u003e format. \u003ca href=\"/docs/18/datatype-datetime.html#INTERVAL-STYLE-OUTPUT-TABLE\" rel=\"nofollow\"\u003eTable 8.18\u003c/a\u003e shows examples of each output style.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003esql_standard\u003c/code\u003e style produces output that conforms to the SQL standard\u0026#39;s specification for interval literal strings, if the interval value meets the standard\u0026#39;s restrictions (either year-month only or day-time only, with no mixing of positive and negative components). Otherwise the output looks like a standard year-month literal string followed by a day-time literal string, with explicit signs added to disambiguate mixed-sign intervals.\u003c/p\u003e\n\u003cp\u003eThe output of the \u003ccode\u003epostgres\u003c/code\u003e style matches the output of \u003cspan\u003ePostgreSQL\u003c/span\u003e releases prior to 8.4 when the \u003ca href=\"/docs/18/runtime-config-client.html#GUC-DATESTYLE\" rel=\"nofollow\"\u003eDateStyle\u003c/a\u003e parameter was set to \u003ccode\u003eISO\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe output of the \u003ccode\u003epostgres_verbose\u003c/code\u003e style matches the output of \u003cspan\u003ePostgreSQL\u003c/span\u003e releases prior to 8.4 when the \u003ccode\u003eDateStyle\u003c/code\u003e parameter was set to non-\u003ccode\u003eISO\u003c/code\u003e output.\u003c/p\u003e\n\u003cp\u003eThe output of the \u003ccode\u003eiso_8601\u003c/code\u003e style matches the \u003cspan\u003e“\u003cspan\u003eformat with designators\u003c/span\u003e”\u003c/span\u003e described in section 4.4.3.2 of the ISO 8601 standard.\u003c/p\u003e\n\u003cdiv id=\"INTERVAL-STYLE-OUTPUT-TABLE\"\u003e\n\u003cp\u003e\u003cstrong\u003eTable 8.18. Interval Output Style Examples\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n\u003ctable\u003e\n\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eStyle Specification\u003c/th\u003e\n\u003cth\u003eYear-Month Interval\u003c/th\u003e\n\u003cth\u003eDay-Time Interval\u003c/th\u003e\n\u003cth\u003eMixed Interval\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003esql_standard\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e1-2\u003c/td\u003e\n\u003ctd\u003e3 4:05:06\u003c/td\u003e\n\u003ctd\u003e-1-2 +3 -4:05:06\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003epostgres\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e1 year 2 mons\u003c/td\u003e\n\u003ctd\u003e3 days 04:05:06\u003c/td\u003e\n\u003ctd\u003e-1 year -2 mons +3 days -04:05:06\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003epostgres_verbose\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e@ 1 year 2 mons\u003c/td\u003e\n\u003ctd\u003e@ 3 days 4 hours 5 mins 6 secs\u003c/td\u003e\n\u003ctd\u003e@ 1 year 2 mons -3 days 4 hours 5 mins 6 secs ago\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eiso_8601\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eP1Y2M\u003c/td\u003e\n\u003ctd\u003eP3DT4H5M6S\u003c/td\u003e\n\u003ctd\u003eP-1Y-2M3D​T-4H-5M-6S\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr\u003e\n\u003c/div\u003e\n\u003c/div\u003e","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","ContentHash":"f1738d185f5c68f9ffa162ef854f69ce65cf64684c136b487749f674d2f72871","Payload":{"description":["date and time, including time zone"],"manual_html":"\u003cdiv class=\"sect1\" id=\"DATATYPE-DATETIME\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch2 class=\"title\"\u003e8.5. Date/Time Types \u003c/h2\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003cp\u003e\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e supports the full set of SQL date and time types, shown in \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-TABLE\" title=\"Table 8.9. Date/Time Types\"\u003eTable 8.9\u003c/a\u003e. The operations available on these data types are described in \u003ca class=\"xref\" href=\"/docs/18/functions-datetime.html\" title=\"9.9. Date/Time Functions and Operators\"\u003eSection 9.9\u003c/a\u003e. Dates are counted according to the Gregorian calendar, even in years before that calendar was introduced (see \u003ca class=\"xref\" href=\"/docs/18/datetime-units-history.html\" title=\"B.6. History of Units\"\u003eSection B.6\u003c/a\u003e for more information).\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-DATETIME-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.9. Date/Time Types\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eName\u003c/th\u003e\n\u003cth\u003eStorage Size\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003cth\u003eLow Value\u003c/th\u003e\n\u003cth\u003eHigh Value\u003c/th\u003e\n\u003cth\u003eResolution\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003etimestamp [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] [ without time zone ]\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e8 bytes\u003c/td\u003e\n\u003ctd\u003eboth date and time (no time zone)\u003c/td\u003e\n\u003ctd\u003e4713 BC\u003c/td\u003e\n\u003ctd\u003e294276 AD\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003etimestamp [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] with time zone\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e8 bytes\u003c/td\u003e\n\u003ctd\u003eboth date and time, with time zone\u003c/td\u003e\n\u003ctd\u003e4713 BC\u003c/td\u003e\n\u003ctd\u003e294276 AD\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e4 bytes\u003c/td\u003e\n\u003ctd\u003edate (no time of day)\u003c/td\u003e\n\u003ctd\u003e4713 BC\u003c/td\u003e\n\u003ctd\u003e5874897 AD\u003c/td\u003e\n\u003ctd\u003e1 day\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003etime [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] [ without time zone ]\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e8 bytes\u003c/td\u003e\n\u003ctd\u003etime of day (no date)\u003c/td\u003e\n\u003ctd\u003e00:00:00\u003c/td\u003e\n\u003ctd\u003e24:00:00\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003etime [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] with time zone\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e12 bytes\u003c/td\u003e\n\u003ctd\u003etime of day (no date), with time zone\u003c/td\u003e\n\u003ctd\u003e00:00:00+1559\u003c/td\u003e\n\u003ctd\u003e24:00:00-1559\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003einterval [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e ] [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ]\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e16 bytes\u003c/td\u003e\n\u003ctd\u003etime interval\u003c/td\u003e\n\u003ctd\u003e-178000000 years\u003c/td\u003e\n\u003ctd\u003e178000000 years\u003c/td\u003e\n\u003ctd\u003e1 microsecond\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eThe SQL standard requires that writing just \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e be equivalent to \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e, and \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e honors that behavior. \u003ccode class=\"type\"\u003etimestamptz\u003c/code\u003e is accepted as an abbreviation for \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e; this is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ccode class=\"type\"\u003etime\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, and \u003ccode class=\"type\"\u003einterval\u003c/code\u003e accept an optional precision value \u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e which specifies the number of fractional digits retained in the seconds field. By default, there is no explicit bound on precision. The allowed range of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e is from 0 to 6.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"type\"\u003einterval\u003c/code\u003e type has an additional option, which is to restrict the set of stored fields by writing one of these phrases:\u003c/p\u003e\n\u003cpre class=\"literallayout\"\u003eYEAR\nMONTH\nDAY\nHOUR\nMINUTE\nSECOND\nYEAR TO MONTH\nDAY TO HOUR\nDAY TO MINUTE\nDAY TO SECOND\nHOUR TO MINUTE\nHOUR TO SECOND\nMINUTE TO SECOND\n\u003c/pre\u003e\n\u003cp\u003eNote that if both \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e and \u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e are specified, the \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e must include \u003ccode class=\"literal\"\u003eSECOND\u003c/code\u003e, since the precision applies only to the seconds.\u003c/p\u003e\n\u003cp\u003eThe type \u003ccode class=\"type\"\u003etime with time zone\u003c/code\u003e is defined by the SQL standard, but the definition exhibits properties which lead to questionable usefulness. In most cases, a combination of \u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etime\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e, and \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e should provide a complete range of date/time functionality required by any application.\u003c/p\u003e\n\u003cdiv class=\"sect2\" id=\"DATATYPE-DATETIME-INPUT\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3 class=\"title\"\u003e8.5.1. Date/Time Input \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eDate and time input is accepted in almost any reasonable format, including ISO 8601, SQL-compatible, traditional \u003cspan class=\"productname\"\u003ePOSTGRES\u003c/span\u003e, and others. For some formats, ordering of day, month, and year in date input is ambiguous and there is support for specifying the expected ordering of these fields. Set the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DATESTYLE\"\u003eDateStyle\u003c/a\u003e parameter to \u003ccode class=\"literal\"\u003eMDY\u003c/code\u003e to select month-day-year interpretation, \u003ccode class=\"literal\"\u003eDMY\u003c/code\u003e to select day-month-year interpretation, or \u003ccode class=\"literal\"\u003eYMD\u003c/code\u003e to select year-month-day interpretation.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e is more flexible in handling date/time input than the SQL standard requires. See \u003ca class=\"xref\" href=\"/docs/18/datetime-appendix.html\" title=\"Appendix B. Date/Time Support\"\u003eAppendix B\u003c/a\u003e for the exact parsing rules of date/time input and for the recognized text fields including months, days of the week, and time zones.\u003c/p\u003e\n\u003cp\u003eRemember that any date or time literal input needs to be enclosed in single quotes, like text strings. Refer to \u003ca class=\"xref\" href=\"/docs/18/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-GENERIC\" title=\"4.1.2.7. Constants of Other Types\"\u003eSection 4.1.2.7\u003c/a\u003e for more information. SQL requires the following syntax\u003c/p\u003e\n\u003cpre class=\"synopsis\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003etype\u003c/code\u003e\u003c/em\u003e [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] '\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e'\n\u003c/pre\u003e\n\u003cp\u003ewhere \u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e is an optional precision specification giving the number of fractional digits in the seconds field. Precision can be specified for \u003ccode class=\"type\"\u003etime\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, and \u003ccode class=\"type\"\u003einterval\u003c/code\u003e types, and can range from 0 to 6. If no precision is specified in a constant specification, it defaults to the precision of the literal value (but not more than 6 digits).\u003c/p\u003e\n\u003cdiv class=\"sect3\" id=\"DATATYPE-DATETIME-INPUT-DATES\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch4 class=\"title\"\u003e8.5.1.1. Dates \u003c/h4\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-DATE-TABLE\" title=\"Table 8.10. Date Input\"\u003eTable 8.10\u003c/a\u003e shows some possible inputs for the \u003ccode class=\"type\"\u003edate\u003c/code\u003e type.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-DATETIME-DATE-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.10. Date Input\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e1999-01-08\u003c/td\u003e\n\u003ctd\u003eISO 8601; January 8 in any mode (recommended format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJanuary 8, 1999\u003c/td\u003e\n\u003ctd\u003eunambiguous in any \u003ccode class=\"varname\"\u003edatestyle\u003c/code\u003e input mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1/8/1999\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in \u003ccode class=\"literal\"\u003eMDY\u003c/code\u003e mode; August 1 in \u003ccode class=\"literal\"\u003eDMY\u003c/code\u003e mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1/18/1999\u003c/td\u003e\n\u003ctd\u003eJanuary 18 in \u003ccode class=\"literal\"\u003eMDY\u003c/code\u003e mode; rejected in other modes\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e01/02/03\u003c/td\u003e\n\u003ctd\u003eJanuary 2, 2003 in \u003ccode class=\"literal\"\u003eMDY\u003c/code\u003e mode; February 1, 2003 in \u003ccode class=\"literal\"\u003eDMY\u003c/code\u003e mode; February 3, 2001 in \u003ccode class=\"literal\"\u003eYMD\u003c/code\u003e mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1999-Jan-08\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJan-08-1999\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e08-Jan-1999\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e99-Jan-08\u003c/td\u003e\n\u003ctd\u003eJanuary 8 in \u003ccode class=\"literal\"\u003eYMD\u003c/code\u003e mode, else error\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e08-Jan-99\u003c/td\u003e\n\u003ctd\u003eJanuary 8, except error in \u003ccode class=\"literal\"\u003eYMD\u003c/code\u003e mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJan-08-99\u003c/td\u003e\n\u003ctd\u003eJanuary 8, except error in \u003ccode class=\"literal\"\u003eYMD\u003c/code\u003e mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e19990108\u003c/td\u003e\n\u003ctd\u003eISO 8601; January 8, 1999 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e990108\u003c/td\u003e\n\u003ctd\u003eISO 8601; January 8, 1999 in any mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1999.008\u003c/td\u003e\n\u003ctd\u003eyear and day of year\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJ2451187\u003c/td\u003e\n\u003ctd\u003eJulian date\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eJanuary 8, 99 BC\u003c/td\u003e\n\u003ctd\u003eyear 99 BC\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect3\" id=\"DATATYPE-DATETIME-INPUT-TIMES\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch4 class=\"title\"\u003e8.5.1.2. Times \u003c/h4\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eThe time-of-day types are \u003ccode class=\"type\"\u003etime [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] without time zone\u003c/code\u003e and \u003ccode class=\"type\"\u003etime [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ep\u003c/code\u003e\u003c/em\u003e) ] with time zone\u003c/code\u003e. \u003ccode class=\"type\"\u003etime\u003c/code\u003e alone is equivalent to \u003ccode class=\"type\"\u003etime without time zone\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eValid input for these types consists of a time of day followed by an optional time zone. (See \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-TIME-TABLE\" title=\"Table 8.11. Time Input\"\u003eTable 8.11\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONE-TABLE\" title=\"Table 8.12. Time Zone Input\"\u003eTable 8.12\u003c/a\u003e.) If a time zone is specified in the input for \u003ccode class=\"type\"\u003etime without time zone\u003c/code\u003e, it is silently ignored. You can also specify a date but it will be ignored, except when you use a time zone name that involves a daylight-savings rule, such as \u003ccode class=\"literal\"\u003eAmerica/New_York\u003c/code\u003e. In this case specifying the date is required in order to determine whether standard or daylight-savings time applies. The appropriate time zone offset is recorded in the \u003ccode class=\"type\"\u003etime with time zone\u003c/code\u003e value and is output as stored; it is not adjusted to the active time zone.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-DATETIME-TIME-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.11. Time Input\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05:06.789\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05:06\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e040506\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05 AM\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003esame as 04:05; AM does not affect value\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05 PM\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003esame as 16:05; input hour must be \u0026lt;= 12\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05:06.789-8\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05:06-08:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05-08:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e040506-08\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e040506+0730\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, with fractional-hour time zone as UTC offset\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e040506+07:30:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset specified to seconds (not allowed in ISO 8601)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e04:05:06 PST\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003etime zone specified by abbreviation\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e2003-04-12 04:05:06 America/New_York\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003etime zone specified by full name\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-TIMEZONE-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.12. Time Zone Input\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003ePST\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eAbbreviation (for Pacific Standard Time)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eAmerica/New_York\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eFull time zone name\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003ePST8PDT\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003ePOSIX-style time zone specification\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e-8:00:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset for PST\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e-8:00\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset for PST (ISO 8601 extended format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e-800\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset for PST (ISO 8601 basic format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e-8\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eUTC offset for PST (ISO 8601 basic format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003ezulu\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eMilitary abbreviation for UTC\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003ez\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eShort form of \u003ccode class=\"literal\"\u003ezulu\u003c/code\u003e (also in ISO 8601)\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cp\u003eRefer to \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3. Time Zones\"\u003eSection 8.5.3\u003c/a\u003e for more information on how to specify time zones.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect3\" id=\"DATATYPE-DATETIME-INPUT-TIME-STAMPS\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch4 class=\"title\"\u003e8.5.1.3. Time Stamps \u003c/h4\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eValid input for the time stamp types consists of the concatenation of a date and a time, followed by an optional time zone, followed by an optional \u003ccode class=\"literal\"\u003eAD\u003c/code\u003e or \u003ccode class=\"literal\"\u003eBC\u003c/code\u003e. (Alternatively, \u003ccode class=\"literal\"\u003eAD\u003c/code\u003e/\u003ccode class=\"literal\"\u003eBC\u003c/code\u003e can appear before the time zone, but this is not the preferred ordering.) Thus:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003e1999-01-08 04:05:06\n\u003c/pre\u003e\n\u003cp\u003eand:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003e1999-01-08 04:05:06 -8:00\n\u003c/pre\u003e\n\u003cp\u003eare valid values, which follow the ISO 8601 standard. In addition, the common format:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eJanuary 8 04:05:06 1999 PST\n\u003c/pre\u003e\n\u003cp\u003eis supported.\u003c/p\u003e\n\u003cp\u003eThe SQL standard differentiates \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e and \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e literals by the presence of a \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e+\u003c/span\u003e”\u003c/span\u003e or \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e-\u003c/span\u003e”\u003c/span\u003e symbol and time zone offset after the time. Hence, according to the standard,\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eTIMESTAMP '2004-10-19 10:23:54'\n\u003c/pre\u003e\n\u003cp\u003eis a \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e, while\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eTIMESTAMP '2004-10-19 10:23:54+02'\n\u003c/pre\u003e\n\u003cp\u003eis a \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e never examines the content of a literal string before determining its type, and therefore will treat both of the above as \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e. To ensure that a literal is treated as \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, give it the correct explicit type:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eTIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+02'\n\u003c/pre\u003e\n\u003cp\u003eIn a value that has been determined to be \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e, \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e will silently ignore any time zone indication. That is, the resulting value is derived from the date/time fields in the input string, and is not adjusted for time zone.\u003c/p\u003e\n\u003cp\u003eFor \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e values, an input string that includes an explicit time zone will be converted to UTC (\u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-UTC\"\u003e\u003c/a\u003e\u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-UTC\" title=\"UTC\"\u003eUniversal Coordinated Time\u003c/a\u003e) using the appropriate offset for that time zone. If no time zone is stated in the input string, then it is assumed to be in the time zone indicated by the system's \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\"\u003eTimeZone\u003c/a\u003e parameter, and is converted to UTC using the offset for the \u003ccode class=\"varname\"\u003etimezone\u003c/code\u003e zone. In either case, the value is stored internally as UTC, and the originally stated or assumed time zone is not retained.\u003c/p\u003e\n\u003cp\u003eWhen a \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e value is output, it is always converted from UTC to the current \u003ccode class=\"varname\"\u003etimezone\u003c/code\u003e zone, and displayed as local time in that zone. To see the time in another time zone, either change \u003ccode class=\"varname\"\u003etimezone\u003c/code\u003e or use the \u003ccode class=\"literal\"\u003eAT TIME ZONE\u003c/code\u003e construct (see \u003ca class=\"xref\" href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT\" title=\"9.9.4. AT TIME ZONE and AT LOCAL\"\u003eSection 9.9.4\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eConversions between \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e and \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e normally assume that the \u003ccode class=\"type\"\u003etimestamp without time zone\u003c/code\u003e value should be taken or given as \u003ccode class=\"varname\"\u003etimezone\u003c/code\u003e local time. A different time zone can be specified for the conversion using \u003ccode class=\"literal\"\u003eAT TIME ZONE\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect3\" id=\"DATATYPE-DATETIME-SPECIAL-VALUES\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch4 class=\"title\"\u003e8.5.1.4. Special Values \u003c/h4\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e supports several special date/time input values for convenience, as shown in \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-SPECIAL-TABLE\" title=\"Table 8.13. Special Date/Time Inputs\"\u003eTable 8.13\u003c/a\u003e. The values \u003ccode class=\"literal\"\u003einfinity\u003c/code\u003e and \u003ccode class=\"literal\"\u003e-infinity\u003c/code\u003e are specially represented inside the system and will be displayed unchanged; but the others are simply notational shorthands that will be converted to ordinary date/time values when read. (In particular, \u003ccode class=\"literal\"\u003enow\u003c/code\u003e and related strings are converted to a specific time value as soon as they are read.) All of these values need to be enclosed in single quotes when used as constants in SQL commands.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-DATETIME-SPECIAL-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.13. Special Date/Time Inputs\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eInput String\u003c/th\u003e\n\u003cth\u003eValid Types\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eepoch\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e1970-01-01 00:00:00+00 (Unix system time zero)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003einfinity\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003einterval\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003elater than all other time stamps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e-infinity\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003einterval\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eearlier than all other time stamps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003enow\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etime\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003ecurrent transaction's start time\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003etoday\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003emidnight (\u003ccode class=\"literal\"\u003e00:00\u003c/code\u003e) today\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003etomorrow\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003emidnight (\u003ccode class=\"literal\"\u003e00:00\u003c/code\u003e) tomorrow\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eyesterday\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003edate\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003emidnight (\u003ccode class=\"literal\"\u003e00:00\u003c/code\u003e) yesterday\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eallballs\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"type\"\u003etime\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e00:00:00.00 UTC\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cp\u003eThe following SQL-compatible functions can also be used to obtain the current time value for the corresponding data type: \u003ccode class=\"literal\"\u003eCURRENT_DATE\u003c/code\u003e, \u003ccode class=\"literal\"\u003eCURRENT_TIME\u003c/code\u003e, \u003ccode class=\"literal\"\u003eCURRENT_TIMESTAMP\u003c/code\u003e, \u003ccode class=\"literal\"\u003eLOCALTIME\u003c/code\u003e, \u003ccode class=\"literal\"\u003eLOCALTIMESTAMP\u003c/code\u003e. (See \u003ca class=\"xref\" href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT\" title=\"9.9.5. Current Date/Time\"\u003eSection 9.9.5\u003c/a\u003e.) Note that these are SQL functions and are \u003cspan class=\"emphasis\"\u003e\u003cem\u003enot\u003c/em\u003e\u003c/span\u003e recognized in data input strings.\u003c/p\u003e\n\u003cdiv class=\"caution\"\u003e\n\u003ch3 class=\"title\"\u003eCaution\u003c/h3\u003e\n\u003cp\u003eWhile the input strings \u003ccode class=\"literal\"\u003enow\u003c/code\u003e, \u003ccode class=\"literal\"\u003etoday\u003c/code\u003e, \u003ccode class=\"literal\"\u003etomorrow\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eyesterday\u003c/code\u003e are fine to use in interactive SQL commands, they can have surprising behavior when the command is saved to be executed later, for example in prepared statements, views, and function definitions. The string can be converted to a specific time value that continues to be used long after it becomes stale. Use one of the SQL functions instead in such contexts. For example, \u003ccode class=\"literal\"\u003eCURRENT_DATE + 1\u003c/code\u003e is safer than \u003ccode class=\"literal\"\u003e'tomorrow'::date\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect2\" id=\"DATATYPE-DATETIME-OUTPUT\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3 class=\"title\"\u003e8.5.2. Date/Time Output \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eThe output format of the date/time types can be set to one of the four styles ISO 8601, SQL (Ingres), traditional \u003cspan class=\"productname\"\u003ePOSTGRES\u003c/span\u003e (Unix \u003cspan class=\"application\"\u003edate\u003c/span\u003e format), or German. The default is the ISO format. (The SQL standard requires the use of the ISO 8601 format. The name of the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eSQL\u003c/span\u003e”\u003c/span\u003e output format is a historical accident.) \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT-TABLE\" title=\"Table 8.14. Date/Time Output Styles\"\u003eTable 8.14\u003c/a\u003e shows examples of each output style. The output of the \u003ccode class=\"type\"\u003edate\u003c/code\u003e and \u003ccode class=\"type\"\u003etime\u003c/code\u003e types is generally only the date or time part in accordance with the given examples. However, the \u003cspan class=\"productname\"\u003ePOSTGRES\u003c/span\u003e style outputs date-only values in ISO format.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-DATETIME-OUTPUT-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.14. Date/Time Output Styles\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eStyle Specification\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eISO\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601, SQL standard\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e1997-12-17 07:37:16-08\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eSQL\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003etraditional style\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e12/17/1997 07:37:16.00 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003ePostgres\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eoriginal style\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eWed Dec 17 07:37:16 1997 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eGerman\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eregional style\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e17.12.1997 07:37:16.00 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eISO 8601 specifies the use of uppercase letter \u003ccode class=\"literal\"\u003eT\u003c/code\u003e to separate the date and time. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e accepts that format on input, but on output it uses a space rather than \u003ccode class=\"literal\"\u003eT\u003c/code\u003e, as shown above. This is for readability and for consistency with \u003ca class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc3339\"\u003eRFC 3339\u003c/a\u003e as well as some other database systems.\u003c/p\u003e\n\u003c/div\u003e\n\u003cp\u003eIn the SQL and POSTGRES styles, day appears before month if DMY field ordering has been specified, otherwise month appears before day. (See \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-INPUT\" title=\"8.5.1. Date/Time Input\"\u003eSection 8.5.1\u003c/a\u003e for how this setting also affects interpretation of input values.) \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT2-TABLE\" title=\"Table 8.15. Date Order Conventions\"\u003eTable 8.15\u003c/a\u003e shows examples.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-DATETIME-OUTPUT2-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.15. Date Order Conventions\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003e\u003ccode class=\"varname\"\u003edatestyle\u003c/code\u003e Setting\u003c/th\u003e\n\u003cth\u003eInput Ordering\u003c/th\u003e\n\u003cth\u003eExample Output\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eSQL, DMY\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eday\u003c/code\u003e\u003c/em\u003e/\u003cem class=\"replaceable\"\u003e\u003ccode\u003emonth\u003c/code\u003e\u003c/em\u003e/\u003cem class=\"replaceable\"\u003e\u003ccode\u003eyear\u003c/code\u003e\u003c/em\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e17/12/1997 15:37:16.00 CET\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eSQL, MDY\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003emonth\u003c/code\u003e\u003c/em\u003e/\u003cem class=\"replaceable\"\u003e\u003ccode\u003eday\u003c/code\u003e\u003c/em\u003e/\u003cem class=\"replaceable\"\u003e\u003ccode\u003eyear\u003c/code\u003e\u003c/em\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e12/17/1997 07:37:16.00 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003ePostgres, DMY\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eday\u003c/code\u003e\u003c/em\u003e/\u003cem class=\"replaceable\"\u003e\u003ccode\u003emonth\u003c/code\u003e\u003c/em\u003e/\u003cem class=\"replaceable\"\u003e\u003ccode\u003eyear\u003c/code\u003e\u003c/em\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eWed 17 Dec 07:37:16 1997 PST\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cp\u003eIn the ISO style, the time zone is always shown as a signed numeric offset from UTC, with positive sign used for zones east of Greenwich. The offset will be shown as \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehh\u003c/code\u003e\u003c/em\u003e (hours only) if it is an integral number of hours, else as \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehh\u003c/code\u003e\u003c/em\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003emm\u003c/code\u003e\u003c/em\u003e if it is an integral number of minutes, else as \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehh\u003c/code\u003e\u003c/em\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003emm\u003c/code\u003e\u003c/em\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003ess\u003c/code\u003e\u003c/em\u003e. (The third case is not possible with any modern time zone standard, but it can appear when working with timestamps that predate the adoption of standardized time zones.) In the other date styles, the time zone is shown as an alphabetic abbreviation if one is in common use in the current zone. Otherwise it appears as a signed numeric offset in ISO 8601 basic format (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehh\u003c/code\u003e\u003c/em\u003e or \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehhmm\u003c/code\u003e\u003c/em\u003e). The alphabetic abbreviations shown in these styles are taken from the IANA time zone database entry currently selected by the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\"\u003eTimeZone\u003c/a\u003e run-time parameter; they are not affected by the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE-ABBREVIATIONS\"\u003etimezone_abbreviations\u003c/a\u003e setting.\u003c/p\u003e\n\u003cp\u003eThe date/time style can be selected by the user using the \u003ccode class=\"command\"\u003eSET datestyle\u003c/code\u003e command, the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DATESTYLE\"\u003eDateStyle\u003c/a\u003e parameter in the \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e configuration file, or the \u003ccode class=\"envar\"\u003ePGDATESTYLE\u003c/code\u003e environment variable on the server or client.\u003c/p\u003e\n\u003cp\u003eThe formatting function \u003ccode class=\"function\"\u003eto_char\u003c/code\u003e (see \u003ca class=\"xref\" href=\"/docs/18/functions-formatting.html\" title=\"9.8. Data Type Formatting Functions\"\u003eSection 9.8\u003c/a\u003e) is also available as a more flexible way to format date/time output.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect2\" id=\"DATATYPE-TIMEZONES\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3 class=\"title\"\u003e8.5.3. Time Zones \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eTime zones, and time-zone conventions, are influenced by political decisions, not just earth geometry. Time zones around the world became somewhat standardized during the 1900s, but continue to be prone to arbitrary changes, particularly with respect to daylight-savings rules. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e uses the widely-used IANA (Olson) time zone database for information about historical time zone rules. For times in the future, the assumption is that the latest known rules for a given time zone will continue to be observed indefinitely far into the future.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e endeavors to be compatible with the SQL standard definitions for typical usage. However, the SQL standard has an odd mix of date and time types and capabilities. Two obvious problems are:\u003c/p\u003e\n\u003cdiv class=\"itemizedlist\"\u003e\n\u003cul class=\"itemizedlist\"\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eAlthough the \u003ccode class=\"type\"\u003edate\u003c/code\u003e type cannot have an associated time zone, the \u003ccode class=\"type\"\u003etime\u003c/code\u003e type can. Time zones in the real world have little meaning unless associated with a date as well as a time, since the offset can vary through the year with daylight-saving time boundaries.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eThe default time zone is specified as a constant numeric offset from UTC. It is therefore impossible to adapt to daylight-saving time when doing date/time arithmetic across DST boundaries.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003cp\u003eTo address these difficulties, we recommend using date/time types that contain both date and time when using time zones. We do \u003cspan class=\"emphasis\"\u003e\u003cem\u003enot\u003c/em\u003e\u003c/span\u003e recommend using the type \u003ccode class=\"type\"\u003etime with time zone\u003c/code\u003e (though it is supported by \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e for legacy applications and for compliance with the SQL standard). \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e assumes your local time zone for any type containing only date or time.\u003c/p\u003e\n\u003cp\u003eAll timezone-aware dates and times are stored internally in UTC. They are converted to local time in the zone specified by the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\"\u003eTimeZone\u003c/a\u003e configuration parameter before being displayed to the client.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e allows you to specify time zones in three different forms:\u003c/p\u003e\n\u003cdiv class=\"itemizedlist\"\u003e\n\u003cul class=\"itemizedlist\"\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eA full time zone name, for example \u003ccode class=\"literal\"\u003eAmerica/New_York\u003c/code\u003e. The recognized time zone names are listed in the \u003ccode class=\"literal\"\u003epg_timezone_names\u003c/code\u003e view (see \u003ca class=\"xref\" href=\"/docs/18/view-pg-timezone-names.html\" title=\"53.34. pg_timezone_names\"\u003eSection 53.34\u003c/a\u003e). \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e uses the widely-used IANA time zone data for this purpose, so the same time zone names are also recognized by other software.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eA time zone abbreviation, for example \u003ccode class=\"literal\"\u003ePST\u003c/code\u003e. Such a specification merely defines a particular offset from UTC, in contrast to full time zone names which can imply a set of daylight savings transition rules as well. The recognized abbreviations are listed in the \u003ccode class=\"literal\"\u003epg_timezone_abbrevs\u003c/code\u003e view (see \u003ca class=\"xref\" href=\"/docs/18/view-pg-timezone-abbrevs.html\" title=\"53.33. pg_timezone_abbrevs\"\u003eSection 53.33\u003c/a\u003e). You cannot set the configuration parameters \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\"\u003eTimeZone\u003c/a\u003e or \u003ca class=\"xref\" href=\"/docs/18/runtime-config-logging.html#GUC-LOG-TIMEZONE\"\u003elog_timezone\u003c/a\u003e to a time zone abbreviation, but you can use abbreviations in date/time input values and with the \u003ccode class=\"literal\"\u003eAT TIME ZONE\u003c/code\u003e operator.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eIn addition to the timezone names and abbreviations, \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e will accept POSIX-style time zone specifications, as described in \u003ca class=\"xref\" href=\"/docs/18/datetime-posix-timezone-specs.html\" title=\"B.5. POSIX Time Zone Specifications\"\u003eSection B.5\u003c/a\u003e. This option is not normally preferable to using a named time zone, but it may be necessary if no suitable IANA time zone entry is available.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003cp\u003eIn short, this is the difference between abbreviations and full names: abbreviations represent a specific offset from UTC, whereas many of the full names imply a local daylight-savings time rule, and so have two possible UTC offsets. As an example, \u003ccode class=\"literal\"\u003e2014-06-04 12:00 America/New_York\u003c/code\u003e represents noon local time in New York, which for this particular date was Eastern Daylight Time (UTC-4). So \u003ccode class=\"literal\"\u003e2014-06-04 12:00 EDT\u003c/code\u003e specifies that same time instant. But \u003ccode class=\"literal\"\u003e2014-06-04 12:00 EST\u003c/code\u003e specifies noon Eastern Standard Time (UTC-5), regardless of whether daylight savings was nominally in effect on that date.\u003c/p\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eThe sign in POSIX-style time zone specifications has the opposite meaning of the sign in ISO-8601 datetime values. For example, the POSIX time zone for \u003ccode class=\"literal\"\u003e2014-06-04 12:00+04\u003c/code\u003e would be UTC-4.\u003c/p\u003e\n\u003c/div\u003e\n\u003cp\u003eTo complicate matters, some jurisdictions have used the same timezone abbreviation to mean different UTC offsets at different times; for example, in Moscow \u003ccode class=\"literal\"\u003eMSK\u003c/code\u003e has meant UTC+3 in some years and UTC+4 in others. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e interprets such abbreviations according to whatever they meant (or had most recently meant) on the specified date; but, as with the \u003ccode class=\"literal\"\u003eEST\u003c/code\u003e example above, this is not necessarily the same as local civil time on that date.\u003c/p\u003e\n\u003cp\u003eIn all cases, timezone names and abbreviations are recognized case-insensitively. (This is a change from \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e versions prior to 8.2, which were case-sensitive in some contexts but not others.)\u003c/p\u003e\n\u003cp\u003eNeither timezone names nor abbreviations are hard-wired into the server; they are obtained from configuration files stored under \u003ccode class=\"filename\"\u003e.../share/timezone/\u003c/code\u003e and \u003ccode class=\"filename\"\u003e.../share/timezonesets/\u003c/code\u003e of the installation directory (see \u003ca class=\"xref\" href=\"/docs/18/datetime-config-files.html\" title=\"B.4. Date/Time Configuration Files\"\u003eSection B.4\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eThe \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-TIMEZONE\"\u003eTimeZone\u003c/a\u003e configuration parameter can be set in the file \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e, or in any of the other standard ways described in \u003ca class=\"xref\" href=\"/docs/18/runtime-config.html\" title=\"Chapter 19. Server Configuration\"\u003eChapter 19\u003c/a\u003e. There are also some special ways to set it:\u003c/p\u003e\n\u003cdiv class=\"itemizedlist\"\u003e\n\u003cul class=\"itemizedlist\"\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eThe SQL command \u003ccode class=\"command\"\u003eSET TIME ZONE\u003c/code\u003e sets the time zone for the session. This is an alternative spelling of \u003ccode class=\"command\"\u003eSET TIMEZONE TO\u003c/code\u003e with a more SQL-spec-compatible syntax.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003eThe \u003ccode class=\"envar\"\u003ePGTZ\u003c/code\u003e environment variable is used by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e clients to send a \u003ccode class=\"command\"\u003eSET TIME ZONE\u003c/code\u003e command to the server upon connection.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect2\" id=\"DATATYPE-INTERVAL-INPUT\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3 class=\"title\"\u003e8.5.4. Interval Input \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ccode class=\"type\"\u003einterval\u003c/code\u003e values can be written using the following verbose syntax:\u003c/p\u003e\n\u003cpre class=\"synopsis\"\u003e[\u003cspan class=\"optional\"\u003e@\u003c/span\u003e] \u003cem class=\"replaceable\"\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e...\u003c/span\u003e] [\u003cspan class=\"optional\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edirection\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e]\n\u003c/pre\u003e\n\u003cp\u003ewhere \u003cem class=\"replaceable\"\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e is a number (possibly signed); \u003cem class=\"replaceable\"\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e is \u003ccode class=\"literal\"\u003emicrosecond\u003c/code\u003e, \u003ccode class=\"literal\"\u003emillisecond\u003c/code\u003e, \u003ccode class=\"literal\"\u003esecond\u003c/code\u003e, \u003ccode class=\"literal\"\u003eminute\u003c/code\u003e, \u003ccode class=\"literal\"\u003ehour\u003c/code\u003e, \u003ccode class=\"literal\"\u003eday\u003c/code\u003e, \u003ccode class=\"literal\"\u003eweek\u003c/code\u003e, \u003ccode class=\"literal\"\u003emonth\u003c/code\u003e, \u003ccode class=\"literal\"\u003eyear\u003c/code\u003e, \u003ccode class=\"literal\"\u003edecade\u003c/code\u003e, \u003ccode class=\"literal\"\u003ecentury\u003c/code\u003e, \u003ccode class=\"literal\"\u003emillennium\u003c/code\u003e, or abbreviations or plurals of these units; \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirection\u003c/code\u003e\u003c/em\u003e can be \u003ccode class=\"literal\"\u003eago\u003c/code\u003e or empty. The at sign (\u003ccode class=\"literal\"\u003e@\u003c/code\u003e) is optional noise. The amounts of the different units are implicitly added with appropriate sign accounting. \u003ccode class=\"literal\"\u003eago\u003c/code\u003e negates all the fields. This syntax is also used for interval output, if \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-INTERVALSTYLE\"\u003eIntervalStyle\u003c/a\u003e is set to \u003ccode class=\"literal\"\u003epostgres_verbose\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eQuantities of days, hours, minutes, and seconds can be specified without explicit unit markings. For example, \u003ccode class=\"literal\"\u003e'1 12:59:10'\u003c/code\u003e is read the same as \u003ccode class=\"literal\"\u003e'1 day 12 hours 59 min 10 sec'\u003c/code\u003e. Also, a combination of years and months can be specified with a dash; for example \u003ccode class=\"literal\"\u003e'200-10'\u003c/code\u003e is read the same as \u003ccode class=\"literal\"\u003e'200 years 10 months'\u003c/code\u003e. (These shorter forms are in fact the only ones allowed by the SQL standard, and are used for output when \u003ccode class=\"varname\"\u003eIntervalStyle\u003c/code\u003e is set to \u003ccode class=\"literal\"\u003esql_standard\u003c/code\u003e.)\u003c/p\u003e\n\u003cp\u003eInterval values can also be written as ISO 8601 time intervals, using either the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eformat with designators\u003c/span\u003e”\u003c/span\u003e of the standard's section 4.4.3.2 or the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ealternative format\u003c/span\u003e”\u003c/span\u003e of section 4.4.3.3. The format with designators looks like this:\u003c/p\u003e\n\u003cpre class=\"synopsis\"\u003eP \u003cem class=\"replaceable\"\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e ...\u003c/span\u003e] [\u003cspan class=\"optional\"\u003e T [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003equantity\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eunit\u003c/code\u003e\u003c/em\u003e ...\u003c/span\u003e]\u003c/span\u003e]\n\u003c/pre\u003e\n\u003cp\u003eThe string must start with a \u003ccode class=\"literal\"\u003eP\u003c/code\u003e, and may include a \u003ccode class=\"literal\"\u003eT\u003c/code\u003e that introduces the time-of-day units. The available unit abbreviations are given in \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-INTERVAL-ISO8601-UNITS\" title=\"Table 8.16. ISO 8601 Interval Unit Abbreviations\"\u003eTable 8.16\u003c/a\u003e. Units may be omitted, and may be specified in any order, but units smaller than a day must appear after \u003ccode class=\"literal\"\u003eT\u003c/code\u003e. In particular, the meaning of \u003ccode class=\"literal\"\u003eM\u003c/code\u003e depends on whether it is before or after \u003ccode class=\"literal\"\u003eT\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-INTERVAL-ISO8601-UNITS\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.16. ISO 8601 Interval Unit Abbreviations\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eAbbreviation\u003c/th\u003e\n\u003cth\u003eMeaning\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eY\u003c/td\u003e\n\u003ctd\u003eYears\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eM\u003c/td\u003e\n\u003ctd\u003eMonths (in the date part)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eW\u003c/td\u003e\n\u003ctd\u003eWeeks\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eD\u003c/td\u003e\n\u003ctd\u003eDays\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eH\u003c/td\u003e\n\u003ctd\u003eHours\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eM\u003c/td\u003e\n\u003ctd\u003eMinutes (in the time part)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eS\u003c/td\u003e\n\u003ctd\u003eSeconds\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003cp\u003eIn the alternative format:\u003c/p\u003e\n\u003cpre class=\"synopsis\"\u003eP [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eyears\u003c/code\u003e\u003c/em\u003e-\u003cem class=\"replaceable\"\u003e\u003ccode\u003emonths\u003c/code\u003e\u003c/em\u003e-\u003cem class=\"replaceable\"\u003e\u003ccode\u003edays\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e T \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehours\u003c/code\u003e\u003c/em\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003eminutes\u003c/code\u003e\u003c/em\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e]\n\u003c/pre\u003e\n\u003cp\u003ethe string must begin with \u003ccode class=\"literal\"\u003eP\u003c/code\u003e, and a \u003ccode class=\"literal\"\u003eT\u003c/code\u003e separates the date and time parts of the interval. The values are given as numbers similar to ISO 8601 dates.\u003c/p\u003e\n\u003cp\u003eWhen writing an interval constant with a \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e specification, or when assigning a string to an interval column that was defined with a \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e specification, the interpretation of unmarked quantities depends on the \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e. For example \u003ccode class=\"literal\"\u003eINTERVAL '1' YEAR\u003c/code\u003e is read as 1 year, whereas \u003ccode class=\"literal\"\u003eINTERVAL '1'\u003c/code\u003e means 1 second. Also, field values \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eto the right\u003c/span\u003e”\u003c/span\u003e of the least significant field allowed by the \u003cem class=\"replaceable\"\u003e\u003ccode\u003efields\u003c/code\u003e\u003c/em\u003e specification are silently discarded. For example, writing \u003ccode class=\"literal\"\u003eINTERVAL '1 day 2:03:04' HOUR TO MINUTE\u003c/code\u003e results in dropping the seconds field, but not the day field.\u003c/p\u003e\n\u003cp\u003eAccording to the SQL standard all fields of an interval value must have the same sign, so a leading negative sign applies to all fields; for example the negative sign in the interval literal \u003ccode class=\"literal\"\u003e'-1 2:03:04'\u003c/code\u003e applies to both the days and hour/minute/second parts. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e allows the fields to have different signs, and traditionally treats each field in the textual representation as independently signed, so that the hour/minute/second part is considered positive in this example. If \u003ccode class=\"varname\"\u003eIntervalStyle\u003c/code\u003e is set to \u003ccode class=\"literal\"\u003esql_standard\u003c/code\u003e then a leading sign is considered to apply to all fields (but only if no additional signs appear). Otherwise the traditional \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e interpretation is used. To avoid ambiguity, it's recommended to attach an explicit sign to each field if any field is negative.\u003c/p\u003e\n\u003cp\u003eInternally, \u003ccode class=\"type\"\u003einterval\u003c/code\u003e values are stored as three integral fields: months, days, and microseconds. These fields are kept separate because the number of days in a month varies, while a day can have 23 or 25 hours if a daylight savings time transition is involved. An interval input string that uses other units is normalized into this format, and then reconstructed in a standardized way for output, for example:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eSELECT '2 years 15 months 100 weeks 99 hours 123456789 milliseconds'::interval;\n               interval\n---------------------------------------\n 3 years 3 mons 700 days 133:17:36.789\n\u003c/pre\u003e\n\u003cp\u003eHere weeks, which are understood as \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e7 days\u003c/span\u003e”\u003c/span\u003e, have been kept separate, while the smaller and larger time units were combined and normalized.\u003c/p\u003e\n\u003cp\u003eInput field values can have fractional parts, for example \u003ccode class=\"literal\"\u003e'1.5 weeks'\u003c/code\u003e or \u003ccode class=\"literal\"\u003e'01:02:03.45'\u003c/code\u003e. However, because \u003ccode class=\"type\"\u003einterval\u003c/code\u003e internally stores only integral fields, fractional values must be converted into smaller units. Fractional parts of units greater than months are rounded to be an integer number of months, e.g. \u003ccode class=\"literal\"\u003e'1.5 years'\u003c/code\u003e becomes \u003ccode class=\"literal\"\u003e'1 year 6 mons'\u003c/code\u003e. Fractional parts of weeks and days are computed to be an integer number of days and microseconds, assuming 30 days per month and 24 hours per day, e.g., \u003ccode class=\"literal\"\u003e'1.75 months'\u003c/code\u003e becomes \u003ccode class=\"literal\"\u003e1 mon 22 days 12:00:00\u003c/code\u003e. Only seconds will ever be shown as fractional on output.\u003c/p\u003e\n\u003cp\u003e\u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-INTERVAL-INPUT-EXAMPLES\" title=\"Table 8.17. Interval Input\"\u003eTable 8.17\u003c/a\u003e shows some examples of valid \u003ccode class=\"type\"\u003einterval\u003c/code\u003e input.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"DATATYPE-INTERVAL-INPUT-EXAMPLES\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.17. Interval Input\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eExample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e1-2\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eSQL standard format: 1 year 2 months\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e3 4:05:06\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eSQL standard format: 3 days 4 hours 5 minutes 6 seconds\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003e1 year 2 months 3 days 4 hours 5 minutes 6 seconds\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eTraditional Postgres format: 1 year 2 months 3 days 4 hours 5 minutes 6 seconds\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eP1Y2M3DT4H5M6S\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601 \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eformat with designators\u003c/span\u003e”\u003c/span\u003e: same meaning as above\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eP0001-02-03T04:05:06\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eISO 8601 \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ealternative format\u003c/span\u003e”\u003c/span\u003e: same meaning as above\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003c/div\u003e\n\u003cdiv class=\"sect2\" id=\"DATATYPE-INTERVAL-OUTPUT\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch3 class=\"title\"\u003e8.5.5. Interval Output \u003c/h3\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eAs previously explained, \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e stores \u003ccode class=\"type\"\u003einterval\u003c/code\u003e values as months, days, and microseconds. For output, the months field is converted to years and months by dividing by 12. The days field is shown as-is. The microseconds field is converted to hours, minutes, seconds, and fractional seconds. Thus months, minutes, and seconds will never be shown as exceeding the ranges 0–11, 0–59, and 0–59 respectively, while the displayed years, days, and hours fields can be quite large. (The \u003ca class=\"link\" href=\"/docs/18/functions-datetime.html#FUNCTION-JUSTIFY-DAYS\"\u003e\u003ccode class=\"function\"\u003ejustify_days\u003c/code\u003e\u003c/a\u003e and \u003ca class=\"link\" href=\"/docs/18/functions-datetime.html#FUNCTION-JUSTIFY-HOURS\"\u003e\u003ccode class=\"function\"\u003ejustify_hours\u003c/code\u003e\u003c/a\u003e functions can be used if it is desirable to transpose large days or hours values into the next higher field.)\u003c/p\u003e\n\u003cp\u003eThe output format of the interval type can be set to one of the four styles \u003ccode class=\"literal\"\u003esql_standard\u003c/code\u003e, \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e, \u003ccode class=\"literal\"\u003epostgres_verbose\u003c/code\u003e, or \u003ccode class=\"literal\"\u003eiso_8601\u003c/code\u003e, using the command \u003ccode class=\"literal\"\u003eSET intervalstyle\u003c/code\u003e. The default is the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e format. \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#INTERVAL-STYLE-OUTPUT-TABLE\" title=\"Table 8.18. Interval Output Style Examples\"\u003eTable 8.18\u003c/a\u003e shows examples of each output style.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"literal\"\u003esql_standard\u003c/code\u003e style produces output that conforms to the SQL standard's specification for interval literal strings, if the interval value meets the standard's restrictions (either year-month only or day-time only, with no mixing of positive and negative components). Otherwise the output looks like a standard year-month literal string followed by a day-time literal string, with explicit signs added to disambiguate mixed-sign intervals.\u003c/p\u003e\n\u003cp\u003eThe output of the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e style matches the output of \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e releases prior to 8.4 when the \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DATESTYLE\"\u003eDateStyle\u003c/a\u003e parameter was set to \u003ccode class=\"literal\"\u003eISO\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe output of the \u003ccode class=\"literal\"\u003epostgres_verbose\u003c/code\u003e style matches the output of \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e releases prior to 8.4 when the \u003ccode class=\"varname\"\u003eDateStyle\u003c/code\u003e parameter was set to non-\u003ccode class=\"literal\"\u003eISO\u003c/code\u003e output.\u003c/p\u003e\n\u003cp\u003eThe output of the \u003ccode class=\"literal\"\u003eiso_8601\u003c/code\u003e style matches the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eformat with designators\u003c/span\u003e”\u003c/span\u003e described in section 4.4.3.2 of the ISO 8601 standard.\u003c/p\u003e\n\u003cdiv class=\"table\" id=\"INTERVAL-STYLE-OUTPUT-TABLE\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eTable 8.18. Interval Output Style Examples\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"table-contents\"\u003e\n\u003ctable class=\"table\"\u003e\n\n\n\n\n\n\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eStyle Specification\u003c/th\u003e\n\u003cth\u003eYear-Month Interval\u003c/th\u003e\n\u003cth\u003eDay-Time Interval\u003c/th\u003e\n\u003cth\u003eMixed Interval\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003esql_standard\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e1-2\u003c/td\u003e\n\u003ctd\u003e3 4:05:06\u003c/td\u003e\n\u003ctd\u003e-1-2 +3 -4:05:06\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e1 year 2 mons\u003c/td\u003e\n\u003ctd\u003e3 days 04:05:06\u003c/td\u003e\n\u003ctd\u003e-1 year -2 mons +3 days -04:05:06\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003epostgres_verbose\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e@ 1 year 2 mons\u003c/td\u003e\n\u003ctd\u003e@ 3 days 4 hours 5 mins 6 secs\u003c/td\u003e\n\u003ctd\u003e@ 1 year 2 mons -3 days 4 hours 5 mins 6 secs ago\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode class=\"literal\"\u003eiso_8601\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eP1Y2M\u003c/td\u003e\n\u003ctd\u003eP3DT4H5M6S\u003c/td\u003e\n\u003ctd\u003eP-1Y-2M3D​T-4H-5M-6S\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"table-break\"\u003e\n\u003c/div\u003e\n\u003c/div\u003e","related":[{"label":"pg_type catalog","url":"/wiki/catalog/pg_type/?v=18"},{"label":"pg_cast catalog","url":"/wiki/catalog/pg_cast/?v=18"},{"label":"pg_operator catalog","url":"/wiki/catalog/pg_operator/?v=18"},{"label":"pg_opclass catalog","url":"/wiki/catalog/pg_opclass/?v=18"},{"label":"Arrays","url":"/wiki/type/arrays/?v=18"},{"label":"brin index access method","url":"/wiki/indexam/brin/?v=18"},{"label":"btree index access method","url":"/wiki/indexam/btree/?v=18"},{"label":"hash index access method","url":"/wiki/indexam/hash/?v=18"}],"sections":[]}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
