DateTime
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
상용시(또는 간혹 물리적 시간)를 나타냅니다.
이 유형은 다음 몇 가지 가능한 방법 중 하나로 상용시를 나타낼 수 있습니다.
- utcOffset이 설정되고 timeZone이 설정되지 않은 경우: UTC 기준으로 특정 오프셋이 있는 캘린더 일자의 상용시입니다.
- timeZone이 설정되고 utcOffset이 설정되지 않은 경우: 특정 시간대의 캘린더 일자 상용시입니다.
- timeZone 또는 utcOffset이 모두 설정되지 않은 경우: 현지 시간으로 캘린더 일자의 상용시입니다.
날짜는 그레고리력을 기준으로 합니다.
연도, 월, 일이 0이면 DateTime에 각각 특정 연도, 월, 일이 없는 것으로 간주됩니다.
이 유형은 모든 날짜 및 시간 필드가 설정되었고 time_offset
중 하나가 설정된 경우 실제 시간을 나타내는 데 사용될 수도 있습니다. 실제 시간으로 대신 Timestamp
메시지를 사용하는 것이 좋습니다. 사용 사례에서 사용자의 시간대를 저장하려는 경우 다른 필드에서 저장할 수 있습니다.
이 유형은 일부 애플리케이션에 필요한 것보다 더 유연합니다. 애플리케이션의 제한사항을 문서화하고 검증하세요.
JSON 표현 |
{
"year": integer,
"month": integer,
"day": integer,
"hours": integer,
"minutes": integer,
"seconds": integer,
"nanos": integer,
// Union field time_offset can be only one of the following:
"utcOffset": string,
"timeZone": {
object (TimeZone )
}
// End of list of possible types for union field time_offset .
} |
필드 |
year |
integer
선택사항입니다. 연도. 1~9999 사이의 값이어야 합니다. 단, 연도 없이 날짜/시간을 지정할 경우 0입니다.
|
month |
integer
선택사항입니다. 월. 1~12 사이의 값이어야 합니다. 단, 월 없이 날짜/시간을 지정할 경우 0입니다.
|
day |
integer
선택사항입니다. 일. 1~31 사이의 값이어야 하며 유효한 연도와 월이어야 합니다. 정해진 날 없이 날짜/시간을 지정할 경우 0입니다.
|
hours |
integer
선택사항입니다. 24시간 형식의 시간입니다. 0~23 사이의 값이어야 하며 기본값은 0(자정)입니다. API는 비즈니스 종료 시간과 같은 시나리오에서 '24:00:00' 값을 허용하도록 선택할 수 있습니다.
|
minutes |
integer
선택사항입니다. 특정 시간의 분입니다. 0에서 59 사이의 값이어야 하며 기본값은 0입니다.
|
seconds |
integer
선택사항입니다. 특정 분의 초입니다. 일반적으로 0에서 59 사이의 값이어야 하며 기본값은 0입니다. API가 윤초를 허용하는 경우 값에 60을 사용할 수 있습니다.
|
nanos |
integer
선택사항입니다. 나노초 단위의 초수입니다. 0~999,999,999 사이의 값이어야 하며 기본값은 0입니다.
|
통합 필드 time_offset . 선택사항입니다. UTC 오프셋 또는 DateTime의 시간대를 지정합니다. 이후에 시간대 데이터가 변경될 수 있으므로(예: 국가에서 DST 시작일/종료일을 수정하고 영향을 받는 범위의 향후 DateTime이 이미 저장된 경우) 이 점을 고려하여 신중하게 선택하세요. 생략하면 DateTime이 현지 시간으로 간주됩니다. time_offset 은 다음 중 하나여야 합니다. |
utcOffset |
string (Duration format)
UTC 오프셋입니다. -18시간에서 +18시간 사이의 정수 초여야 합니다. 예를 들어 UTC 오프셋 -4:00은 {초: -14400}으로 표현됩니다. 소수점 아래가 최대 9자리까지이고 's '로 끝나는 초 단위 기간입니다. 예를 들면 "3.5s" 입니다.
|
timeZone |
object (TimeZone )
시간대입니다.
|
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-29(UTC)
[null,null,["최종 업데이트: 2025-08-29(UTC)"],[],[],null,["# DateTime\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n\nRepresents civil time (or occasionally physical time).\n\nThis type can represent a civil time in one of a few possible ways:\n\n- When utcOffset is set and timeZone is unset: a civil time on a calendar day with a particular offset from UTC.\n- When timeZone is set and utcOffset is unset: a civil time on a calendar day in a particular time zone.\n- When neither timeZone nor utcOffset is set: a civil time on a calendar day in local time.\n\nThe date is relative to the Proleptic Gregorian Calendar.\n\nIf year, month, or day are 0, the DateTime is considered not to have a specific year, month, or day respectively.\n\nThis type may also be used to represent a physical time if all the date and time fields are set and either case of the `time_offset` oneof is set. Consider using `Timestamp` message for physical time instead. If your use case also would like to store the user's timezone, that can be done in another field.\n\nThis type is more flexible than some applications may want. Make sure to document and validate your application's limitations.\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"year\": integer, \"month\": integer, \"day\": integer, \"hours\": integer, \"minutes\": integer, \"seconds\": integer, \"nanos\": integer, // Union field `time_offset` can be only one of the following: \"utcOffset\": string, \"timeZone\": { object (/maps/documentation/weather/reference/rest/v1/TimeZone) } // End of list of possible types for union field `time_offset`. } ``` |\n\n| Fields ||\n|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `year` | `integer` Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a datetime without a year. |\n| `month` | `integer` Optional. Month of year. Must be from 1 to 12, or 0 if specifying a datetime without a month. |\n| `day` | `integer` Optional. Day of month. Must be from 1 to 31 and valid for the year and month, or 0 if specifying a datetime without a day. |\n| `hours` | `integer` Optional. Hours of day in 24 hour format. Should be from 0 to 23, defaults to 0 (midnight). An API may choose to allow the value \"24:00:00\" for scenarios like business closing time. |\n| `minutes` | `integer` Optional. Minutes of hour of day. Must be from 0 to 59, defaults to 0. |\n| `seconds` | `integer` Optional. Seconds of minutes of the time. Must normally be from 0 to 59, defaults to 0. An API may allow the value 60 if it allows leap-seconds. |\n| `nanos` | `integer` Optional. Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999, defaults to 0. |\n| Union field `time_offset`. Optional. Specifies either the UTC offset or the time zone of the DateTime. Choose carefully between them, considering that time zone data may change in the future (for example, a country modifies their DST start/end dates, and future DateTimes in the affected range had already been stored). If omitted, the DateTime is considered to be in local time. `time_offset` can be only one of the following: ||\n| `utc``Offset` | `string (`[Duration](https://protobuf.dev/reference/protobuf/google.protobuf/#duration)` format)` UTC offset. Must be whole seconds, between -18 hours and +18 hours. For example, a UTC offset of -4:00 would be represented as { seconds: -14400 }. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `\"3.5s\"`. |\n| `time``Zone` | `object (`[TimeZone](/maps/documentation/weather/reference/rest/v1/TimeZone)`)` Time zone. |"]]