Reference documentation and code samples for the Cloud Channel V1 API class Google::Type::DateTime.
Represents civil time (or occasionally physical time).
This type can represent a civil time in one of a few possible ways:
When utc_offset is set and time_zone is unset: a civil time on a calendar
day with a particular offset from UTC.
When time_zone is set and utc_offset is unset: a civil time on a calendar
day in a particular time zone.
When neither time_zone nor utc_offset is set: a civil time on a calendar
day in local time.
The date is relative to the Proleptic Gregorian Calendar.
If year is 0, the DateTime is considered not to have a specific year. month
and day must have valid, non-zero values.
This 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.
This type is more flexible than some applications may want. Make sure to
document and validate your application's limitations.
Inherits
Object
Extended By
Google::Protobuf::MessageExts::ClassMethods
Includes
Google::Protobuf::MessageExts
Methods
#day
defday()->::Integer
Returns
(::Integer) — Required. Day of month. Must be from 1 to 31 and valid for the year and
month.
#day=
defday=(value)->::Integer
Parameter
value (::Integer) — Required. Day of month. Must be from 1 to 31 and valid for the year and
month.
Returns
(::Integer) — Required. Day of month. Must be from 1 to 31 and valid for the year and
month.
#hours
defhours()->::Integer
Returns
(::Integer) — Required. Hours of day in 24 hour format. Should be from 0 to 23. An API
may choose to allow the value "24:00:00" for scenarios like business
closing time.
#hours=
defhours=(value)->::Integer
Parameter
value (::Integer) — Required. Hours of day in 24 hour format. Should be from 0 to 23. An API
may choose to allow the value "24:00:00" for scenarios like business
closing time.
Returns
(::Integer) — Required. Hours of day in 24 hour format. Should be from 0 to 23. An API
may choose to allow the value "24:00:00" for scenarios like business
closing time.
#minutes
defminutes()->::Integer
Returns
(::Integer) — Required. Minutes of hour of day. Must be from 0 to 59.
#minutes=
defminutes=(value)->::Integer
Parameter
value (::Integer) — Required. Minutes of hour of day. Must be from 0 to 59.
Returns
(::Integer) — Required. Minutes of hour of day. Must be from 0 to 59.
#month
defmonth()->::Integer
Returns
(::Integer) — Required. Month of year. Must be from 1 to 12.
#month=
defmonth=(value)->::Integer
Parameter
value (::Integer) — Required. Month of year. Must be from 1 to 12.
Returns
(::Integer) — Required. Month of year. Must be from 1 to 12.
#nanos
defnanos()->::Integer
Returns
(::Integer) — Required. Fractions of seconds in nanoseconds. Must be from 0 to
999,999,999.
#nanos=
defnanos=(value)->::Integer
Parameter
value (::Integer) — Required. Fractions of seconds in nanoseconds. Must be from 0 to
999,999,999.
Returns
(::Integer) — Required. Fractions of seconds in nanoseconds. Must be from 0 to
999,999,999.
#seconds
defseconds()->::Integer
Returns
(::Integer) — Required. Seconds of minutes of the time. Must normally be from 0 to 59. An
API may allow the value 60 if it allows leap-seconds.
#seconds=
defseconds=(value)->::Integer
Parameter
value (::Integer) — Required. Seconds of minutes of the time. Must normally be from 0 to 59. An
API may allow the value 60 if it allows leap-seconds.
Returns
(::Integer) — Required. Seconds of minutes of the time. Must normally be from 0 to 59. An
API may allow the value 60 if it allows leap-seconds.
Note: The following fields are mutually exclusive: time_zone, utc_offset. If a field in that set is populated, all other fields in the set will automatically be cleared.
Note: The following fields are mutually exclusive: time_zone, utc_offset. If a field in that set is populated, all other fields in the set will automatically be cleared.
Note: The following fields are mutually exclusive: time_zone, utc_offset. If a field in that set is populated, all other fields in the set will automatically be cleared.
#utc_offset
defutc_offset()->::Google::Protobuf::Duration
Returns
(::Google::Protobuf::Duration) — 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 }.
Note: The following fields are mutually exclusive: utc_offset, time_zone. If a field in that set is populated, all other fields in the set will automatically be cleared.
value (::Google::Protobuf::Duration) — 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 }.
Note: The following fields are mutually exclusive: utc_offset, time_zone. If a field in that set is populated, all other fields in the set will automatically be cleared.
Returns
(::Google::Protobuf::Duration) — 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 }.
Note: The following fields are mutually exclusive: utc_offset, time_zone. If a field in that set is populated, all other fields in the set will automatically be cleared.
#year
defyear()->::Integer
Returns
(::Integer) — Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a
datetime without a year.
#year=
defyear=(value)->::Integer
Parameter
value (::Integer) — Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a
datetime without a year.
Returns
(::Integer) — Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a
datetime without a year.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Cloud Channel V1 API - Class Google::Type::DateTime (v2.2.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.2.1 (latest)](/ruby/docs/reference/google-cloud-channel-v1/latest/Google-Type-DateTime)\n- [2.2.0](/ruby/docs/reference/google-cloud-channel-v1/2.2.0/Google-Type-DateTime)\n- [2.1.0](/ruby/docs/reference/google-cloud-channel-v1/2.1.0/Google-Type-DateTime)\n- [2.0.1](/ruby/docs/reference/google-cloud-channel-v1/2.0.1/Google-Type-DateTime)\n- [1.3.0](/ruby/docs/reference/google-cloud-channel-v1/1.3.0/Google-Type-DateTime)\n- [1.2.0](/ruby/docs/reference/google-cloud-channel-v1/1.2.0/Google-Type-DateTime)\n- [1.1.0](/ruby/docs/reference/google-cloud-channel-v1/1.1.0/Google-Type-DateTime)\n- [1.0.1](/ruby/docs/reference/google-cloud-channel-v1/1.0.1/Google-Type-DateTime)\n- [0.24.0](/ruby/docs/reference/google-cloud-channel-v1/0.24.0/Google-Type-DateTime)\n- [0.23.2](/ruby/docs/reference/google-cloud-channel-v1/0.23.2/Google-Type-DateTime)\n- [0.22.1](/ruby/docs/reference/google-cloud-channel-v1/0.22.1/Google-Type-DateTime)\n- [0.21.0](/ruby/docs/reference/google-cloud-channel-v1/0.21.0/Google-Type-DateTime)\n- [0.20.0](/ruby/docs/reference/google-cloud-channel-v1/0.20.0/Google-Type-DateTime)\n- [0.19.0](/ruby/docs/reference/google-cloud-channel-v1/0.19.0/Google-Type-DateTime)\n- [0.18.0](/ruby/docs/reference/google-cloud-channel-v1/0.18.0/Google-Type-DateTime)\n- [0.17.0](/ruby/docs/reference/google-cloud-channel-v1/0.17.0/Google-Type-DateTime)\n- [0.16.0](/ruby/docs/reference/google-cloud-channel-v1/0.16.0/Google-Type-DateTime)\n- [0.15.0](/ruby/docs/reference/google-cloud-channel-v1/0.15.0/Google-Type-DateTime)\n- [0.14.0](/ruby/docs/reference/google-cloud-channel-v1/0.14.0/Google-Type-DateTime)\n- [0.13.0](/ruby/docs/reference/google-cloud-channel-v1/0.13.0/Google-Type-DateTime)\n- [0.12.0](/ruby/docs/reference/google-cloud-channel-v1/0.12.0/Google-Type-DateTime)\n- [0.11.0](/ruby/docs/reference/google-cloud-channel-v1/0.11.0/Google-Type-DateTime)\n- [0.10.0](/ruby/docs/reference/google-cloud-channel-v1/0.10.0/Google-Type-DateTime)\n- [0.9.5](/ruby/docs/reference/google-cloud-channel-v1/0.9.5/Google-Type-DateTime) \nReference documentation and code samples for the Cloud Channel V1 API class Google::Type::DateTime.\n\nRepresents civil time (or occasionally physical time).\n\n\nThis type can represent a civil time in one of a few possible ways:\n\n- When utc_offset is set and time_zone is unset: a civil time on a calendar day with a particular offset from UTC.\n- When time_zone is set and utc_offset is unset: a civil time on a calendar day in a particular time zone.\n- When neither time_zone nor utc_offset 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 is 0, the DateTime is considered not to have a specific year. month\nand day must have valid, non-zero values.\n\nThis type may also be used to represent a physical time if all the date and\ntime fields are set and either case of the `time_offset` oneof is set.\nConsider using `Timestamp` message for physical time instead. If your use\ncase also would like to store the user's timezone, that can be done in\nanother field.\n\n\u003cbr /\u003e\n\nThis type is more flexible than some applications may want. Make sure to\ndocument and validate your application's limitations. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #day\n\n def day() -\u003e ::Integer\n\n**Returns**\n\n- (::Integer) --- Required. Day of month. Must be from 1 to 31 and valid for the year and month.\n\n### #day=\n\n def day=(value) -\u003e ::Integer\n\n**Parameter**\n\n- **value** (::Integer) --- Required. Day of month. Must be from 1 to 31 and valid for the year and month. \n**Returns**\n\n- (::Integer) --- Required. Day of month. Must be from 1 to 31 and valid for the year and month.\n\n### #hours\n\n def hours() -\u003e ::Integer\n\n**Returns**\n\n- (::Integer) --- Required. Hours of day in 24 hour format. Should be from 0 to 23. An API may choose to allow the value \"24:00:00\" for scenarios like business closing time.\n\n### #hours=\n\n def hours=(value) -\u003e ::Integer\n\n**Parameter**\n\n- **value** (::Integer) --- Required. Hours of day in 24 hour format. Should be from 0 to 23. An API may choose to allow the value \"24:00:00\" for scenarios like business closing time. \n**Returns**\n\n- (::Integer) --- Required. Hours of day in 24 hour format. Should be from 0 to 23. An API may choose to allow the value \"24:00:00\" for scenarios like business closing time.\n\n### #minutes\n\n def minutes() -\u003e ::Integer\n\n**Returns**\n\n- (::Integer) --- Required. Minutes of hour of day. Must be from 0 to 59.\n\n### #minutes=\n\n def minutes=(value) -\u003e ::Integer\n\n**Parameter**\n\n- **value** (::Integer) --- Required. Minutes of hour of day. Must be from 0 to 59. \n**Returns**\n\n- (::Integer) --- Required. Minutes of hour of day. Must be from 0 to 59.\n\n### #month\n\n def month() -\u003e ::Integer\n\n**Returns**\n\n- (::Integer) --- Required. Month of year. Must be from 1 to 12.\n\n### #month=\n\n def month=(value) -\u003e ::Integer\n\n**Parameter**\n\n- **value** (::Integer) --- Required. Month of year. Must be from 1 to 12. \n**Returns**\n\n- (::Integer) --- Required. Month of year. Must be from 1 to 12.\n\n### #nanos\n\n def nanos() -\u003e ::Integer\n\n**Returns**\n\n- (::Integer) --- Required. Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.\n\n### #nanos=\n\n def nanos=(value) -\u003e ::Integer\n\n**Parameter**\n\n- **value** (::Integer) --- Required. Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. \n**Returns**\n\n- (::Integer) --- Required. Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.\n\n### #seconds\n\n def seconds() -\u003e ::Integer\n\n**Returns**\n\n- (::Integer) --- Required. Seconds of minutes of the time. Must normally be from 0 to 59. An API may allow the value 60 if it allows leap-seconds.\n\n### #seconds=\n\n def seconds=(value) -\u003e ::Integer\n\n**Parameter**\n\n- **value** (::Integer) --- Required. Seconds of minutes of the time. Must normally be from 0 to 59. An API may allow the value 60 if it allows leap-seconds. \n**Returns**\n\n- (::Integer) --- Required. Seconds of minutes of the time. Must normally be from 0 to 59. An API may allow the value 60 if it allows leap-seconds.\n\n### #time_zone\n\n def time_zone() -\u003e ::Google::Type::TimeZone\n\n**Returns**\n\n- ([::Google::Type::TimeZone](./Google-Type-TimeZone)) --- Time zone.\n\n\n Note: The following fields are mutually exclusive: `time_zone`, `utc_offset`. If a field in that set is populated, all other fields in the set will automatically be cleared.\n\n### #time_zone=\n\n def time_zone=(value) -\u003e ::Google::Type::TimeZone\n\n**Parameter**\n\n- **value** ([::Google::Type::TimeZone](./Google-Type-TimeZone)) --- Time zone.\n\n\nNote: The following fields are mutually exclusive: `time_zone`, `utc_offset`. If a field in that set is populated, all other fields in the set will automatically be cleared. \n**Returns**\n\n- ([::Google::Type::TimeZone](./Google-Type-TimeZone)) --- Time zone.\n\n\n Note: The following fields are mutually exclusive: `time_zone`, `utc_offset`. If a field in that set is populated, all other fields in the set will automatically be cleared.\n\n### #utc_offset\n\n def utc_offset() -\u003e ::Google::Protobuf::Duration\n\n**Returns**\n\n- ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- 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 }.\n\n\n Note: The following fields are mutually exclusive: `utc_offset`, `time_zone`. If a field in that set is populated, all other fields in the set will automatically be cleared.\n\n### #utc_offset=\n\n def utc_offset=(value) -\u003e ::Google::Protobuf::Duration\n\n**Parameter**\n\n- **value** ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- 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 }.\n\n\nNote: The following fields are mutually exclusive: `utc_offset`, `time_zone`. If a field in that set is populated, all other fields in the set will automatically be cleared. \n**Returns**\n\n- ([::Google::Protobuf::Duration](./Google-Protobuf-Duration)) --- 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 }.\n\n\n Note: The following fields are mutually exclusive: `utc_offset`, `time_zone`. If a field in that set is populated, all other fields in the set will automatically be cleared.\n\n### #year\n\n def year() -\u003e ::Integer\n\n**Returns**\n\n- (::Integer) --- Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a datetime without a year.\n\n### #year=\n\n def year=(value) -\u003e ::Integer\n\n**Parameter**\n\n- **value** (::Integer) --- Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a datetime without a year. \n**Returns**\n\n- (::Integer) --- Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a datetime without a year."]]