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 . ज़रूरी नहीं. तारीख और समय के यूटीसी ऑफ़सेट या टाइम ज़ोन की जानकारी देता है. इनमें से किसी एक को चुनते समय ध्यान रखें कि आने वाले समय में टाइम ज़ोन का डेटा बदल सकता है. उदाहरण के लिए, कोई देश अपने डीएसटी की शुरुआत/खत्म होने की तारीखों में बदलाव कर सकता है. साथ ही, जिन तारीखों पर असर पड़ा है उनमें आने वाले समय के लिए, पहले से ही टाइमस्टैंप सेव हो सकते हैं. अगर यह एट्रिब्यूट नहीं दिया गया है, तो तारीख और समय को स्थानीय समय माना जाता है. time_offset इनमें से कोई एक हो सकता है: |
utcOffset |
string (Duration format)
यूटीसी से समय का अंतर. यह संख्या पूरी होनी चाहिए और -18 घंटे से +18 घंटे के बीच होनी चाहिए. उदाहरण के लिए, -4:00 के यूटीसी ऑफ़सेट को { seconds: -14400 } के तौर पर दिखाया जाएगा. सेकंड में कुल अवधि, जिसमें दशमलव के बाद नौ अंक हो सकते हैं. यह अवधि 's ' पर खत्म होती है. उदाहरण: "3.5s" .
|
timeZone |
object (TimeZone )
टाइम ज़ोन.
|
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 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. |"]]