DateTime
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Resmi saati (veya bazen fiziksel saati) temsil eder.
Bu tür, sivil zamanı birkaç olası yöntemden biriyle temsil edebilir:
- utcOffset ayarlandığında ve timeZone ayarlanmadığında: UTC'den belirli bir saat farkı olan bir takvim günündeki sivil saat.
- timeZone ayarlandığında ve utcOffset ayarlanmadığında: Belirli bir saat diliminde bir takvim günündeki sivil saat.
- timeZone veya utcOffset ayarlanmadığında: Yerel saatle bir takvim günündeki sivil saat.
Tarih, Proleptic Gregoryen Takvimi'ne göredir.
Yıl, ay veya gün 0 ise DateTime'in sırasıyla belirli bir yıl, ay veya güne sahip olmadığı kabul edilir.
Tüm tarih ve saat alanları ayarlanmışsa ve time_offset
oneof özelliğinin herhangi bir durumu ayarlanmışsa bu tür, fiziksel bir zamanı temsil etmek için de kullanılabilir. Bunun yerine fiziksel zaman için Timestamp
mesajını kullanabilirsiniz. Kullanım alanınızda kullanıcının saat dilimini de depolamak istiyorsanız bu işlem başka bir alanda yapılabilir.
Bu tür, bazı uygulamaların istediğinden daha esnektir. Uygulamanızın sınırlamalarını belgelediğinizden ve doğruladığınızdan emin olun.
JSON gösterimi |
{
"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 .
} |
Alanlar |
year |
integer
İsteğe bağlı. Tarihin yılı. 1 ile 9999 arasında veya yıl olmadan bir tarih/saat belirtiliyorsa 0 olmalıdır.
|
month |
integer
İsteğe bağlı. Yılın ayı. 1 ile 12 arasında veya ay belirtilmeden bir tarih/saat belirtiliyorsa 0 arasında olmalıdır.
|
day |
integer
İsteğe bağlı. Ayın günü. 1 ile 31 arasında olmalı ve yıl ve ay için geçerli olmalı ya da gün içermeyen bir tarih/saat belirtiliyorsa 0 olmalıdır.
|
hours |
integer
İsteğe bağlı. Günün saati, 24 saatlik biçimde. 0 ile 23 arasında olmalıdır. Varsayılan olarak 0 (gece yarısı) değerini alır. Bir API, işletmenin kapanma zamanı gibi senaryolar için "24:00:00" değerine izin vermeyi seçebilir.
|
minutes |
integer
İsteğe bağlı. Günün saati (dakika cinsinden). 0 ile 59 arasında olmalıdır. Varsayılan olarak 0 değerine ayarlanır.
|
seconds |
integer
İsteğe bağlı. Zamandaki dakikaların saniyeleri. Normalde 0 ile 59 arasında olmalıdır. Varsayılan olarak 0 değerine ayarlanır. Bir API, saniye atlamalarına izin veriyorsa 60 değerine izin verebilir.
|
nanos |
integer
İsteğe bağlı. Nanosaniye cinsinden saniye kesirlerini belirtir. 0 ile 999.999.999 arasında olmalıdır. Varsayılan olarak 0 değerine ayarlanır.
|
Birlik alanı time_offset . İsteğe bağlı. DateTime öğesinin UTC farkını veya saat dilimini belirtir. Saat dilimi verilerinin gelecekte değişebileceğini göz önünde bulundurarak bu seçenekler arasından dikkatli bir şekilde seçim yapın (örneğin, bir ülke yaz saati başlangıç/bitiş tarihlerini değiştirir ve etkilenen aralıktaki gelecekteki DateTime değerleri zaten depolanmışsa). Atlanırsa DateTime değerinin yerel saatte olduğu varsayılır. time_offset yalnızca aşağıdakilerden biri olabilir: |
utcOffset |
string (Duration format)
UTC farkı. -18 saat ile +18 saat arasında tam saniye olmalıdır. Örneğin, -4:00 UTC ofseti { seconds: -14400 } olarak gösterilir. En fazla dokuz kesirli basamak içeren ve "s " ile biten, saniye cinsinden süre. Örnek: "3.5s" .
|
timeZone |
object (TimeZone )
Saat dilimi.
|
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-08-29 UTC.
[null,null,["Son güncelleme tarihi: 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. |"]]