DateTime
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يمثّل الوقت المدني (أو الوقت الفعلي في بعض الأحيان).
يمكن أن يمثّل هذا النوع وقتًا مدنيًا بإحدى الطرق التالية:
- عند ضبط utcOffset وعدم ضبط timeZone: وقت مدني في يوم تقويمي مع تمكين فرق زمني معيّن من التوقيت العالمي المنسق
- عند ضبط timeZone وعدم ضبط utcOffset: وقت مدني في يوم تقويمي في منطقة زمنية معيّنة
- في حال عدم ضبط timeZone أو utcOffset: وقت مدني في يوم تقويمي بالتوقيت المحلي
التاريخ نسبي إلى التقويم الغريغوري المعدل.
إذا كانت السنة أو الشهر أو اليوم تساوي 0، يُعتبر أنّ DateTime لا يتضمّن سنة أو شهرًا أو يومًا محدّدًا على التوالي.
يمكن أيضًا استخدام هذا النوع لتمثيل وقت فعلي في حال ضبط جميع حقول التاريخ والوقت وضبط أي حالة من حالات time_offset
oneof. ننصحك باستخدام رسالة 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 (منتصف الليل). قد تختار واجهة برمجة التطبيقات السماح بالقيمة "24:00:00" لسيناريوهات مثل وقت إغلاق النشاط التجاري.
|
minutes |
integer
اختياريّ. دقائق الساعة من اليوم يجب أن تتراوح بين 0 و59، ويكون الإعداد التلقائي هو 0.
|
seconds |
integer
اختياريّ. الثواني من الدقائق في الوقت يجب أن تتراوح القيمة عادةً بين 0 و59، ويتم ضبطها تلقائيًا على 0. قد تسمح واجهة برمجة التطبيقات بالقيمة 60 إذا كانت تسمح بالثواني الكبيسة.
|
nanos |
integer
اختياريّ. أجزاء من الثانية بالنانوثواني يجب أن تتراوح بين 0 و999,999,999، وتكون القيمة التلقائية هي 0.
|
حقل الربط time_offset اختياريّ. تُستخدَم لتحديد إما التوقيت العالمي المنسّق أو المنطقة الزمنية لـ DateTime. عليك الاختيار بعناية بين الخيارَين، مع الأخذ في الاعتبار أنّ بيانات المنطقة الزمنية قد تتغيّر في المستقبل (على سبيل المثال، يغيّر بلد ما تواريخ بدء/انتهاء التوقيت الصيفي، وقد سبق تخزين تواريخ/أوقات مستقبلية في النطاق المتأثّر). في حال حذف هذه السمة، يتم اعتبار أنّ التاريخ والوقت بالتوقيت المحلي. يمكن أن يكون time_offset واحدًا فقط مما يلي: |
utcOffset |
string (Duration format)
فارق الوقت عن التوقيت العالمي المنسَّق يجب أن تكون ثوانٍ كاملة، ويجب أن تتراوح بين -18 ساعة و18 ساعة. على سبيل المثال، يتم تمثيل التوقيت العالمي المنسَّق الذي يسبق التوقيت المحلي بـ 4:00 على النحو التالي: { seconds: -14400 }. المدة بالثواني مع ما يصل إلى تسعة أرقام كسور، وتنتهي بـ "s ". مثال: "3.5s" .
|
timeZone |
object (TimeZone )
المنطقة الزمنية
|
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],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. |"]]