Compute Engine v1 API - Class DateTime (3.29.0)

public sealed class DateTime : IMessage<DateTime>, IEquatable<DateTime>, IDeepCloneable<DateTime>, IBufferMessage, IMessage

Reference documentation and code samples for the Compute Engine v1 API class 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, month, or day are 0, the DateTime is considered not to have a specific year, month, or day respectively.

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.

Inheritance

object > DateTime

Namespace

Google.Cloud.Compute.V1

Assembly

Google.Cloud.Compute.V1.dll

Constructors

DateTime()

public DateTime()

DateTime(DateTime)

public DateTime(DateTime other)
Parameter
Name Description
other DateTime

Properties

Day

public int Day { get; set; }

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.

Property Value
Type Description
int

HasDay

public bool HasDay { get; }

Gets whether the "day" field is set

Property Value
Type Description
bool

HasHours

public bool HasHours { get; }

Gets whether the "hours" field is set

Property Value
Type Description
bool

HasMinutes

public bool HasMinutes { get; }

Gets whether the "minutes" field is set

Property Value
Type Description
bool

HasMonth

public bool HasMonth { get; }

Gets whether the "month" field is set

Property Value
Type Description
bool

HasNanos

public bool HasNanos { get; }

Gets whether the "nanos" field is set

Property Value
Type Description
bool

HasSeconds

public bool HasSeconds { get; }

Gets whether the "seconds" field is set

Property Value
Type Description
bool

HasUtcOffset

public bool HasUtcOffset { get; }

Gets whether the "utc_offset" field is set

Property Value
Type Description
bool

HasYear

public bool HasYear { get; }

Gets whether the "year" field is set

Property Value
Type Description
bool

Hours

public int Hours { get; set; }

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.

Property Value
Type Description
int

Minutes

public int Minutes { get; set; }

Optional. Minutes of hour of day. Must be from 0 to 59, defaults to 0.

Property Value
Type Description
int

Month

public int Month { get; set; }

Optional. Month of year. Must be from 1 to 12, or 0 if specifying a datetime without a month.

Property Value
Type Description
int

Nanos

public int Nanos { get; set; }

Optional. Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999, defaults to 0.

Property Value
Type Description
int

Seconds

public int Seconds { get; set; }

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.

Property Value
Type Description
int

TimeZone

public TimeZone TimeZone { get; set; }

Time zone.

Property Value
Type Description
TimeZone

UtcOffset

public string UtcOffset { get; set; }

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 }.

Property Value
Type Description
string

Year

public int Year { get; set; }

Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a datetime without a year.

Property Value
Type Description
int