| 1 |
// Copyright 2026 Google LLC |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
syntax = "proto3"; |
| 16 |
|
| 17 |
package google.type; |
| 18 |
|
| 19 |
import "google/protobuf/duration.proto"; |
| 20 |
|
| 21 |
option go_package = "google.golang.org/genproto/googleapis/type/datetime;datetime"; |
| 22 |
option java_multiple_files = true; |
| 23 |
option java_outer_classname = "DateTimeProto"; |
| 24 |
option java_package = "com.google.type"; |
| 25 |
option objc_class_prefix = "GTP"; |
| 26 |
|
| 27 |
// Represents civil time (or occasionally physical time). |
| 28 |
// |
| 29 |
// This type can represent a civil time in one of a few possible ways: |
| 30 |
// |
| 31 |
// * When utc_offset is set and time_zone is unset: a civil time on a calendar |
| 32 |
// day with a particular offset from UTC. |
| 33 |
// * When time_zone is set and utc_offset is unset: a civil time on a calendar |
| 34 |
// day in a particular time zone. |
| 35 |
// * When neither time_zone nor utc_offset is set: a civil time on a calendar |
| 36 |
// day in local time. |
| 37 |
// |
| 38 |
// The date is relative to the Proleptic Gregorian Calendar. |
| 39 |
// |
| 40 |
// If year, month, or day are 0, the DateTime is considered not to have a |
| 41 |
// specific year, month, or day respectively. |
| 42 |
// |
| 43 |
// This type may also be used to represent a physical time if all the date and |
| 44 |
// time fields are set and either case of the `time_offset` oneof is set. |
| 45 |
// Consider using `Timestamp` message for physical time instead. If your use |
| 46 |
// case also would like to store the user's timezone, that can be done in |
| 47 |
// another field. |
| 48 |
// |
| 49 |
// This type is more flexible than some applications may want. Make sure to |
| 50 |
// document and validate your application's limitations. |
| 51 |
message DateTime { |
| 52 |
// Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a |
| 53 |
// datetime without a year. |
| 54 |
int32 year = 1; |
| 55 |
|
| 56 |
// Optional. Month of year. Must be from 1 to 12, or 0 if specifying a |
| 57 |
// datetime without a month. |
| 58 |
int32 month = 2; |
| 59 |
|
| 60 |
// Optional. Day of month. Must be from 1 to 31 and valid for the year and |
| 61 |
// month, or 0 if specifying a datetime without a day. |
| 62 |
int32 day = 3; |
| 63 |
|
| 64 |
// Optional. Hours of day in 24 hour format. Should be from 0 to 23, defaults |
| 65 |
// to 0 (midnight). An API may choose to allow the value "24:00:00" for |
| 66 |
// scenarios like business closing time. |
| 67 |
int32 hours = 4; |
| 68 |
|
| 69 |
// Optional. Minutes of hour of day. Must be from 0 to 59, defaults to 0. |
| 70 |
int32 minutes = 5; |
| 71 |
|
| 72 |
// Optional. Seconds of minutes of the time. Must normally be from 0 to 59, |
| 73 |
// defaults to 0. An API may allow the value 60 if it allows leap-seconds. |
| 74 |
int32 seconds = 6; |
| 75 |
|
| 76 |
// Optional. Fractions of seconds in nanoseconds. Must be from 0 to |
| 77 |
// 999,999,999, defaults to 0. |
| 78 |
int32 nanos = 7; |
| 79 |
|
| 80 |
// Optional. Specifies either the UTC offset or the time zone of the DateTime. |
| 81 |
// Choose carefully between them, considering that time zone data may change |
| 82 |
// in the future (for example, a country modifies their DST start/end dates, |
| 83 |
// and future DateTimes in the affected range had already been stored). |
| 84 |
// If omitted, the DateTime is considered to be in local time. |
| 85 |
oneof time_offset { |
| 86 |
// UTC offset. Must be whole seconds, between -18 hours and +18 hours. |
| 87 |
// For example, a UTC offset of -4:00 would be represented as |
| 88 |
// { seconds: -14400 }. |
| 89 |
google.protobuf.Duration utc_offset = 8; |
| 90 |
|
| 91 |
// Time zone. |
| 92 |
TimeZone time_zone = 9; |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
// Represents a time zone from the |
| 97 |
// [IANA Time Zone Database](https://www.iana.org/time-zones). |
| 98 |
message TimeZone { |
| 99 |
// IANA Time Zone Database time zone. For example "America/New_York". |
| 100 |
string id = 1; |
| 101 |
|
| 102 |
// Optional. IANA Time Zone Database version number. For example "2019a". |
| 103 |
string version = 2; |
| 104 |
} |