MS Azure Log/Azure PostgreSQL

2-4-1. Azure PostgreSQL Data Type - 날짜,시간 형식

mirlog 2023. 1. 19. 10:13

이번에는 날짜/시간 형식에 알아보도록 하겠다.

형식 크기 설명 별칭
timestamp [(p)] [without time zone] 8 바이트 날짜와 시간 모두  
timestamp [(p)] [with time zone] 8 바이트 날짜와 시간 모두 시간대 포함 timestamptz
interval [(p)] 12 바이트 시간 간격  
date 4 바이트 날짜  
time [(p)] [without time zone] 8 바이트 시간  
time [(p)] with time zone 12 바이트 시간, 시간대 첨부 timetz

해당 타입으로 구성 할 수 있는 형태는 date, time, timestamp(date + ' ' + time) 세가지가 존재 하며, 아래와 같은 형태의 데이터 값을 사용 할 수 있다.

1. Dates

Example Description
1999-01-08 ISO 8601; January 8 in any mode (recommended format)
January 8, 1999 unambiguous in any input modedatestyle
1/8/1999 January 8 in mode; August 1 in modeMDYDMY
1/18/1999 January 18 in mode; rejected in other modesMDY
01/02/03 January 2, 2003 in mode; February 1, 2003 in mode; February 3, 2001 in modeMDYDMYYMD
1999-Jan-08 January 8 in any mode
Jan-08-1999 January 8 in any mode
08-Jan-1999 January 8 in any mode
99-Jan-08 January 8 in mode, else errorYMD
08-Jan-99 January 8, except error in modeYMD
Jan-08-99 January 8, except error in modeYMD
19990108 ISO 8601; January 8, 1999 in any mode
990108 ISO 8601; January 8, 1999 in any mode
1999.008 year and day of year
J2451187 Julian date
January 8, 99 BC year 99 BC

 

2-1. Times

Example Description
04:05:06.789 ISO 8601
04:05:06 ISO 8601
04:05 ISO 8601
040506 ISO 8601
04:05 AM same as 04:05; AM does not affect value
04:05 PM same as 16:05; input hour must be <= 12
04:05:06.789-8 ISO 8601, with time zone as UTC offset
04:05:06-08:00 ISO 8601, with time zone as UTC offset
04:05-08:00 ISO 8601, with time zone as UTC offset
040506-08 ISO 8601, with time zone as UTC offset
040506+0730 ISO 8601, with fractional-hour time zone as UTC offset
040506+07:30:00 UTC offset specified to seconds (not allowed in ISO 8601)
04:05:06 PST time zone specified by abbreviation
2003-04-12 04:05:06 America/New_York time zone specified by full name

2-2. Times Zone Input

Example Description
PST Abbreviation (for Pacific Standard Time)
America/New_York Full time zone name
PST8PDT POSIX-style time zone specification
-8:00:00 UTC offset for PST
-8:00 UTC offset for PST (ISO 8601 extended format)
-800 UTC offset for PST (ISO 8601 basic format)
-8 UTC offset for PST (ISO 8601 basic format)
zulu Military abbreviation for UTC
z Short form of (also in ISO 8601)zulu

#참조 : PostgreSQL: Documentation: 11: 8.5. Date/Time Types

 

※ 해당 내용은 날짜/시간 형식에 대해서만 기술해 보았다.

    이런 타입을 통해서 다양한 활용이 가능한데 이부분은 추후 알아 볼 예정입니다. ^^