Table of Contents

Interface IStdDateTimeModule

Namespace
RDCore.SDK.Runtime.Abstract.StdLib
Assembly
RDCore.SDK.dll

MS-VBAL 6.1.2.4 DateTime Module

[StdLibModule(null)]
public interface IStdDateTimeModule

Remarks

Formalizes the public interface of the standard library VBA.DateTime module.

A function the specification declares with no As clause returns a Variant, which holds the type its description says: DateDiff a Long, DatePart and the date-part functions an Integer, DateAdd, DateSerial and TimeSerial a Date. The functions work in the calendar the Calendar() property says, and the properties read the session's clock (ISessionClock).

Methods

Calendar()

MS-VBAL 6.1.2.4.2.1 Calendar Gets the calendar the functions of the module work in.

[StdLibMember(null, Kind = StdLibMemberKind.PropertyGet, ReturnType = typeof(VBCalendar))]
RuntimeSemanticsEvaluationResult<VBLongValue> Calendar()

Returns

RuntimeSemanticsEvaluationResult<VBLongValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Calendar(VBCalendar)

MS-VBAL 6.1.2.4.2.1 Calendar Sets the calendar the functions of the module work in.

[StdLibMember(null, Kind = StdLibMemberKind.PropertyLet)]
RuntimeSemanticsEvaluationResult Calendar(VBCalendar value)

Parameters

value VBCalendar

The calendar.

Returns

RuntimeSemanticsEvaluationResult

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Date()

MS-VBAL 6.1.2.4.2.2 Date Gets the current date of the system, without its time.

[StdLibMember(null, Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBVariantValue> Date()

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

DateAdd(VBStringValue, VBDoubleValue, VBVariantValue)

MS-VBAL 6.1.2.4.1.1 DateAdd Gets a date to which a number of intervals of time is added.

RuntimeSemanticsEvaluationResult<VBVariantValue> DateAdd(VBStringValue interval, VBDoubleValue number, VBVariantValue date)

Parameters

interval VBStringValue

The interval of time to add (IStdDateTimeModule.Intervals).

number VBDoubleValue

How many intervals to add: positive for the future, negative for the past; rounded to the nearest whole number.

date VBVariantValue

The date the intervals are added to.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

The result is never an invalid date: one month after January 31 is the last day of February. A result before the year 100 raises error 5.

DateDiff(VBStringValue, VBVariantValue, VBVariantValue, VBDayOfWeek, VBFirstWeekOfYear)

MS-VBAL 6.1.2.4.1.2 DateDiff Gets the number of intervals of time between two dates.

RuntimeSemanticsEvaluationResult<VBVariantValue> DateDiff(VBStringValue interval, VBVariantValue date1, VBVariantValue date2, VBDayOfWeek firstDayOfWeek = VBDayOfWeek.VBSunday, VBFirstWeekOfYear firstWeekOfYear = VBFirstWeekOfYear.VBFirstJan1)

Parameters

interval VBStringValue

The interval of time to count (IStdDateTimeModule.Intervals).

date1 VBVariantValue

The date counted from.

date2 VBVariantValue

The date counted to.

firstDayOfWeek VBDayOfWeek

The first day of the week. Sunday when unspecified.

firstWeekOfYear VBFirstWeekOfYear

The first week of the year. The week of January 1 when unspecified.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

The count is of the boundaries of the interval between the two: from December 31 to the January 1 after it is one year. A week ("w") is counted on the day of the week date1 falls on, and a calendar week ("ww") on firstDayOfWeek; either counts date2 and not date1. Negative when date1 is the later of the two.

DatePart(VBStringValue, VBVariantValue, VBDayOfWeek, VBFirstWeekOfYear)

MS-VBAL 6.1.2.4.1.3 DatePart Gets one part of a date, in the units of the current calendar.

RuntimeSemanticsEvaluationResult<VBVariantValue> DatePart(VBStringValue interval, VBVariantValue baseDate, VBDayOfWeek firstDayOfWeek = VBDayOfWeek.VBSunday, VBFirstWeekOfYear firstWeekOfYear = VBFirstWeekOfYear.VBFirstJan1)

Parameters

interval VBStringValue

The part of the date to get (IStdDateTimeModule.Intervals).

baseDate VBVariantValue

The date the part is taken from.

firstDayOfWeek VBDayOfWeek

The first day of the week. Sunday when unspecified.

firstWeekOfYear VBFirstWeekOfYear

The first week of the year. The week of January 1 when unspecified.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

DateSerial(VBIntegerValue, VBIntegerValue, VBIntegerValue)

MS-VBAL 6.1.2.4.1.4 DateSerial Gets the date of a year, a month and a day.

RuntimeSemanticsEvaluationResult<VBVariantValue> DateSerial(VBIntegerValue year, VBIntegerValue month, VBIntegerValue day)

Parameters

year VBIntegerValue

The year, from 100 to 9999.

month VBIntegerValue

The month.

day VBIntegerValue

The day.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

A month or a day outside its range carries into the next larger unit: day 35 is a month and some days on, day 0 the last day of the month before. A year from 0 to 99 is a two-digit year: 0 to 29 are 2000 to 2029, and 30 to 99 are 1930 to 1999 (Hijri: 1400 to 1499).

DateStr()

MS-VBAL 6.1.2.4.2.2 Date$ Gets the current date of the system as a 10-character string, mm-dd-yyyy, in the current calendar.

[StdLibMember("Date$", Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBStringValue> DateStr()

Returns

RuntimeSemanticsEvaluationResult<VBStringValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

DateValue(VBStringValue)

MS-VBAL 6.1.2.4.1.5 DateValue Gets the date a string says, without its time.

RuntimeSemanticsEvaluationResult<VBVariantValue> DateValue(VBStringValue date)

Parameters

date VBStringValue

A date, from January 1, 100 to December 31, 9999; it may have a time too.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Day(VBVariantValue)

MS-VBAL 6.1.2.4.1.6 Day Gets the day of the month of a date, from 1 to 31; Null of Null.

RuntimeSemanticsEvaluationResult<VBVariantValue> Day(VBVariantValue date)

Parameters

date VBVariantValue

A value that is let-coercible to a Date.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Hour(VBVariantValue)

MS-VBAL 6.1.2.4.1.7 Hour Gets the hour of the day of a date, from 0 to 23; Null of Null.

RuntimeSemanticsEvaluationResult<VBVariantValue> Hour(VBVariantValue time)

Parameters

time VBVariantValue

A value that is let-coercible to a Date.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Minute(VBVariantValue)

MS-VBAL 6.1.2.4.1.8 Minute Gets the minute of the hour of a date, from 0 to 59; Null of Null.

RuntimeSemanticsEvaluationResult<VBVariantValue> Minute(VBVariantValue time)

Parameters

time VBVariantValue

A value that is let-coercible to a Date.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Month(VBVariantValue)

MS-VBAL 6.1.2.4.1.9 Month Gets the month of the year of a date, from 1 to 12; Null of Null.

RuntimeSemanticsEvaluationResult<VBVariantValue> Month(VBVariantValue date)

Parameters

date VBVariantValue

A value that is let-coercible to a Date.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Now()

MS-VBAL 6.1.2.4.2.3 Now Gets the current date and time of the system.

[StdLibMember(null, Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBVariantValue> Now()

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Second(VBVariantValue)

MS-VBAL 6.1.2.4.1.10 Second Gets the second of the minute of a date, from 0 to 59; Null of Null.

RuntimeSemanticsEvaluationResult<VBVariantValue> Second(VBVariantValue time)

Parameters

time VBVariantValue

A value that is let-coercible to a Date.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Time()

MS-VBAL 6.1.2.4.2.4 Time Gets the current time of the system, without its date.

[StdLibMember(null, Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBVariantValue> Time()

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Time(VBVariantValue)

MS-VBAL 6.1.2.4.2.4 Time Sets the time of the system: of the session's clock (ISessionClock), never the machine's.

[StdLibMember(null, Kind = StdLibMemberKind.PropertyLet)]
RuntimeSemanticsEvaluationResult Time(VBVariantValue value)

Parameters

value VBVariantValue

A value that is let-coercible to a Date: its time is the time set.

Returns

RuntimeSemanticsEvaluationResult

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

TimeSerial(VBIntegerValue, VBIntegerValue, VBIntegerValue)

MS-VBAL 6.1.2.4.1.11 TimeSerial Gets the time of an hour, a minute and a second.

RuntimeSemanticsEvaluationResult<VBVariantValue> TimeSerial(VBIntegerValue hour, VBIntegerValue minute, VBIntegerValue second)

Parameters

hour VBIntegerValue

The hour, from 0 to 23.

minute VBIntegerValue

The minute.

second VBIntegerValue

The second.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

A minute or a second outside its range carries into the next larger unit: 75 minutes is an hour and 15 minutes.

TimeStr()

MS-VBAL 6.1.2.4.2.4 Time$ Gets the current time of the system as an 8-character string, hh:mm:ss.

[StdLibMember("Time$", Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBStringValue> TimeStr()

Returns

RuntimeSemanticsEvaluationResult<VBStringValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

TimeValue(VBStringValue)

MS-VBAL 6.1.2.4.1.12 TimeValue Gets the time a string says, without its date.

RuntimeSemanticsEvaluationResult<VBVariantValue> TimeValue(VBStringValue time)

Parameters

time VBStringValue

A time, from 0:00:00 to 23:59:59; it may have a date too.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Timer()

MS-VBAL 6.1.2.4.2.5 Timer Gets the number of seconds elapsed since midnight, with its fraction.

[StdLibMember(null, Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBSingleValue> Timer()

Returns

RuntimeSemanticsEvaluationResult<VBSingleValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Weekday(VBVariantValue, VBDayOfWeek)

MS-VBAL 6.1.2.4.1.13 Weekday Gets the day of the week of a date, counted from firstDayOfWeek as 1; Null of Null.

RuntimeSemanticsEvaluationResult<VBVariantValue> Weekday(VBVariantValue date, VBDayOfWeek firstDayOfWeek = VBDayOfWeek.VBSunday)

Parameters

date VBVariantValue

A value that is let-coercible to a Date.

firstDayOfWeek VBDayOfWeek

The first day of the week. Sunday when unspecified.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Year(VBVariantValue)

MS-VBAL 6.1.2.4.1.14 Year Gets the year of a date, from 100 to 9999; Null of Null.

RuntimeSemanticsEvaluationResult<VBVariantValue> Year(VBVariantValue date)

Parameters

date VBVariantValue

A value that is let-coercible to a Date.

Returns

RuntimeSemanticsEvaluationResult<VBVariantValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.