ITime Interface

Provides access to members that control the Time.

Description

The ITime interface is used to access a scalar time value. There is no associated temporal reference, so there is no time zone or daylight savings time associated with the value. The ITime interface can be used to do simple conversions, such as setting a year, month and day, then getting querying for a Julian Day number. The ITime interface supports values with nanosecond accuracy. In general, setting individual values such as the year, month, and day can be problematic. for example, if the Month is set to 2 (February) when the day already has the value 31, this will cause an error because there is no February 31st. It would be better to set the month and day at the same time.

Members

Name Description
Method Compare Compares this time to the other time. Returns -1 if this time's value is less, 1 if greater, and 0 otherwise.
Read/write property Day The time's gregorian day.
Read/write property Hour The time's hour.
Read/write property Minute The time's minute.
Read/write property Month The time's gregorian month.
Read/write property Nanoseconds The time's nanoseconds.
Method QueryDayFraction The time's time portion as a day fraction. Corresponds to the Hour, Minute, Second, and Nanoseconds properties.
Method QueryGregorianTime Obtains the time as a gregorian date and time.
Method QueryIntegerTime Obtains the time as an integer time.
Method QueryJulianDayNumber The Time's date portion as a julian (Julius Scaliger) day number. Corresponds to the Year, Month, and Day properties.
Method QueryNanosecondsSinceMidnight The time's time portion as the number of nanoseconds elapsed since midnight. Corresponds to the Hour, Minute, Second, and Nanoseconds properties.
Method QueryOleTime Obtains the time as an OLE automation date object.
Method QueryTicks Obtains the time as the number of ticks since January 1, 0001 AD (Anno Domini).
Method QueryTimeString Obtains the time as a string, based on the given time string format.
Method QueryTimeStringCurrentLocale Obtains the time as a string, based on the current locale.
Method QueryTimeStringCustom Obtains the time as a string, based on the given custom time string format, and locale properties.
Method QueryXMLTimeString Obtains the time as an XML time string.
Read/write property Second The time's second.
Method SetDayFraction The time's time portion as a day fraction. Corresponds to the Hour, Minute, Second, and Nanoseconds properties.
Method SetFromCurrentLocalTime Writes the time to the current date and time on this machine, expressed as the local time.
Method SetFromCurrentUtcTime Writes the time to the current date and time on this machine, expressed as the Coordinated Universal Time (UTC).
Method SetFromGregorianTime Obtains the time from a given gregorian date and time value.
Method SetFromIntegerTime Writes the time from an integer time.
Method SetFromObject Writes the time from a variant object.
Method SetFromOleTime Writes the time from an OLE automation date object.
Method SetFromTicks Writes the time from a given number of ticks since January 1, 0001 AD (Anno Domini) value.
Method SetFromTimeString Writes the time from a string, based on the given time string format.
Method SetFromTimeStringCurrentLocale Obtains the time from a string, based on the current locale.
Method SetFromTimeStringCustom Writes the time from a string, based on the given custom time string formats, and locale properties.
Method SetFromXMLTimeString Writes the time from an XML time string.
Method SetJulianDayNumber The Time's date portion as a julian (Julius Scaliger) day number. Corresponds to the Year, Month, and Day properties.
Method SetNanosecondsSinceMidnight The time's time portion as the number of nanoseconds elapsed since midnight. Corresponds to the Hour, Minute, Second, and Nanoseconds properties.
Method SnapToEndOfMonth Adjust the day value, to the last day in the current month and year.
Method SubtractTime Subtracts a given time, and returns the time duration result.
Method ToLocal Converts the time from Coordinated Universal Time (UTC) value to local (to this machine) time.
Method ToUTC Converts the time from local (to this machine) time value to Coordinated Universal Time (UTC).
Read/write property Year The time's gregorian year.

ITime.Compare Method

Compares this time to the other time. Returns -1 if this time's value is less, 1 if greater, and 0 otherwise.

Public Function Compare ( _
    ByVal otherTime As ITime _
) As Integer
public int Compare (
    ITime otherTime
);

ITime.Day Property

The time's gregorian day.

Public Property Day As Short
public short Day {get; set;}

ITime.Hour Property

The time's hour.

Public Property Hour As Short
public short Hour {get; set;}

ITime.Minute Property

The time's minute.

Public Property Minute As Short
public short Minute {get; set;}

ITime.Month Property

The time's gregorian month.

Public Property Month As Short
public short Month {get; set;}

ITime.Nanoseconds Property

The time's nanoseconds.

Public Property Nanoseconds As Integer
public int Nanoseconds {get; set;}

ITime.QueryDayFraction Method

The time's time portion as a day fraction. Corresponds to the Hour, Minute, Second, and Nanoseconds properties.

Public Function QueryDayFraction ( _
) As Double
public double QueryDayFraction (
);

ITime.QueryGregorianTime Method

Obtains the time as a gregorian date and time.

Public Function QueryGregorianTime ( _
) As WKSDateTime
public WKSDateTime QueryGregorianTime (
);

ITime.QueryIntegerTime Method

Obtains the time as an integer time.

Public Function QueryIntegerTime ( _
    ByVal integerTimeFormat As esriIntegerTimeFormat _
) As Long
public long QueryIntegerTime (
    esriIntegerTimeFormat integerTimeFormat
);

ITime.QueryJulianDayNumber Method

The Time's date portion as a julian (Julius Scaliger) day number. Corresponds to the Year, Month, and Day properties.

Public Function QueryJulianDayNumber ( _
) As Integer
public int QueryJulianDayNumber (
);

ITime.QueryNanosecondsSinceMidnight Method

The time's time portion as the number of nanoseconds elapsed since midnight. Corresponds to the Hour, Minute, Second, and Nanoseconds properties.

Public Function QueryNanosecondsSinceMidnight ( _
) As Long
public long QueryNanosecondsSinceMidnight (
);

ITime.QueryOleTime Method

Obtains the time as an OLE automation date object.

Public Function QueryOleTime ( _
) As DateTime
public DateTime QueryOleTime (
);

ITime.QueryTicks Method

Obtains the time as the number of ticks since January 1, 0001 AD (Anno Domini).

Public Function QueryTicks ( _
) As Long
public long QueryTicks (
);

ITime.QueryTimeString Method

Obtains the time as a string, based on the given time string format.

Public Function QueryTimeString ( _
    ByVal timeStringFormat As esriTimeStringFormat _
) As String
public string QueryTimeString (
    esriTimeStringFormat timeStringFormat
);

ITime.QueryTimeStringCurrentLocale Method

Obtains the time as a string, based on the current locale.

Public Function QueryTimeStringCurrentLocale ( _
    ByVal timeLocaleFormat As esriTimeLocaleFormat _
) As String
public string QueryTimeStringCurrentLocale (
    esriTimeLocaleFormat timeLocaleFormat
);

ITime.QueryTimeStringCustom Method

Obtains the time as a string, based on the given custom time string format, and locale properties.

Public Function QueryTimeStringCustom ( _
    ByVal timeStringFormat As String, _
    ByVal LocaleID As Integer, _
    ByVal amSymbol As String, _
    ByVal pmSymbol As String _
) As String
public string QueryTimeStringCustom (
    string timeStringFormat,
    int LocaleID,
    string amSymbol,
    string pmSymbol
);

Description

This function will provide a time/date string in a format specified by the time format string, date format string, and using the AM/PM designators. The time format string uses the following symbols:

h = hour (12 hour clock)

H = hour (24 hour clock)

m = minute

s = second

t = am/pm designator

hh,mm,ss indicate that there is a leading zero for values less than 10

h,m,s indicate that there is no leading zero

Note that the am/pm designator should not be present when the time is measured using a 24-hour clock

the AM/PM designators will only be used if the time string contains the "t" value

The date format string uses the following symbols:

M = month of the year

d = day of the month

y = year

MM and dd indicate that there is a leading zero when the month/day is less than 10

M and d indicate that there is no leading zero

yy indicates a 2 digit year

yyyy indicates a 4 digit year

ITime.QueryXMLTimeString Method

Obtains the time as an XML time string.

Public Function QueryXMLTimeString ( _
    ByVal TimeReference As ITimeReference _
) As String
public string QueryXMLTimeString (
    ITimeReference TimeReference
);

ITime.Second Property

The time's second.

Public Property Second As Short
public short Second {get; set;}

ITime.SetDayFraction Method

The time's time portion as a day fraction. Corresponds to the Hour, Minute, Second, and Nanoseconds properties.

Public Sub SetDayFraction ( _
    ByVal dayFraction As Double _
)
public void SetDayFraction (
    double dayFraction
);

ITime.SetFromCurrentLocalTime Method

Writes the time to the current date and time on this machine, expressed as the local time.

Public Sub SetFromCurrentLocalTime ( _
)
public void SetFromCurrentLocalTime (
);

ITime.SetFromCurrentUtcTime Method

Writes the time to the current date and time on this machine, expressed as the Coordinated Universal Time (UTC).

Public Sub SetFromCurrentUtcTime ( _
)
public void SetFromCurrentUtcTime (
);

ITime.SetFromGregorianTime Method

Obtains the time from a given gregorian date and time value.

Public Sub SetFromGregorianTime ( _
    ByRef gregorianTime As WKSDateTime _
)
public void SetFromGregorianTime (
    ref WKSDateTime gregorianTime
);

ITime.SetFromIntegerTime Method

Writes the time from an integer time.

Public Sub SetFromIntegerTime ( _
    ByVal integerTimeFormat As esriIntegerTimeFormat, _
    ByVal integerTime As Long _
)
public void SetFromIntegerTime (
    esriIntegerTimeFormat integerTimeFormat,
    long integerTime
);

ITime.SetFromObject Method

Writes the time from a variant object.

Public Sub SetFromObject ( _
    ByVal Object As Object _
)
public void SetFromObject (
    object Object
);

ITime.SetFromOleTime Method

Writes the time from an OLE automation date object.

Public Sub SetFromOleTime ( _
    ByVal oleTime As DateTime _
)
public void SetFromOleTime (
    DateTime oleTime
);

ITime.SetFromTicks Method

Writes the time from a given number of ticks since January 1, 0001 AD (Anno Domini) value.

Public Sub SetFromTicks ( _
    ByVal ticks As Long _
)
public void SetFromTicks (
    long ticks
);

ITime.SetFromTimeString Method

Writes the time from a string, based on the given time string format.

Public Sub SetFromTimeString ( _
    ByVal timeStringFormat As esriTimeStringFormat, _
    ByVal timeString As String _
)
public void SetFromTimeString (
    esriTimeStringFormat timeStringFormat,
    string timeString
);

ITime.SetFromTimeStringCurrentLocale Method

Obtains the time from a string, based on the current locale.

Public Sub SetFromTimeStringCurrentLocale ( _
    ByVal timeLocaleFormat As esriTimeLocaleFormat, _
    ByVal timeString As String _
)
public void SetFromTimeStringCurrentLocale (
    esriTimeLocaleFormat timeLocaleFormat,
    string timeString
);

ITime.SetFromTimeStringCustom Method

Writes the time from a string, based on the given custom time string formats, and locale properties.

Public Sub SetFromTimeStringCustom ( _
    ByVal timeStringFormat As String, _
    ByVal LocaleID As Integer, _
    ByVal amSymbol As String, _
    ByVal pmSymbol As String, _
    ByVal timeString As String _
)
public void SetFromTimeStringCustom (
    string timeStringFormat,
    int LocaleID,
    string amSymbol,
    string pmSymbol,
    string timeString
);

Description

The passed time string is assumed to be in a format specified by the time format string, date format string, and using the AM/PM designators. The time format string uses the following symbols:

h = hour (12 hour clock)

H = hour (24 hour clock)

m = minute

s = second

t = am/pm designator

hh,mm,ss indicate that there is a leading zero for values less than 10

h,m,s indicate that there is no leading zero

Note that the am/pm designator should not be present when the time is measured using a 24-hour clock

the AM/PM designators will only be used if the time string contains the "t" value

The date format string uses the following symbols:

M = month of the year

d = day of the month

y = year

MM and dd indicate that there is a leading zero when the month/day is less than 10

M and d indicate that there is no leading zero

yy indicates a 2 digit year

yyyy indicates a 4 digit year

ITime.SetFromXMLTimeString Method

Writes the time from an XML time string.

Public Function SetFromXMLTimeString ( _
    ByVal xmlTimeString As String _
) As Integer
public int SetFromXMLTimeString (
    string xmlTimeString
);

ITime.SetJulianDayNumber Method

The Time's date portion as a julian (Julius Scaliger) day number. Corresponds to the Year, Month, and Day properties.

Public Sub SetJulianDayNumber ( _
    ByVal julianDayNumber As Integer _
)
public void SetJulianDayNumber (
    int julianDayNumber
);

ITime.SetNanosecondsSinceMidnight Method

The time's time portion as the number of nanoseconds elapsed since midnight. Corresponds to the Hour, Minute, Second, and Nanoseconds properties.

Public Sub SetNanosecondsSinceMidnight ( _
    ByVal nanosecondsSinceMidnight As Long _
)
public void SetNanosecondsSinceMidnight (
    long nanosecondsSinceMidnight
);

ITime.SnapToEndOfMonth Method

Adjust the day value, to the last day in the current month and year.

Public Sub SnapToEndOfMonth ( _
)
public void SnapToEndOfMonth (
);

Description

SnapToEndOfMonth changes the current date of the Time object, but not the hours, minutes, or seconds. It changes the date to the last day of the month. If the current month is February, then the resulting date will depend on if the current year is a leap year.

ITime.SubtractTime Method

Subtracts a given time, and returns the time duration result.

Public Function SubtractTime ( _
    ByVal Time As ITime _
) As ITimeDuration
public ITimeDuration SubtractTime (
    ITime Time
);

Description

This function subtracts the passed time value from the current time, and returns the difference in the TimeDuration parameter. If the passed time value is before the current time value, then the result will be positive. If the passed time value is after the current time value, then the result will be negative.

ITime.ToLocal Method

Converts the time from Coordinated Universal Time (UTC) value to local (to this machine) time.

Public Sub ToLocal ( _
)
public void ToLocal (
);

ITime.ToUTC Method

Converts the time from local (to this machine) time value to Coordinated Universal Time (UTC).

Public Sub ToUTC ( _
)
public void ToUTC (
);

ITime.Year Property

The time's gregorian year.

Public Property Year As Short
public short Year {get; set;}

Classes that implement ITime

Classes Description
Time An object that represents a date and time value.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.