DateTimeOps class | QSYS API Reference Guide

Estimated reading time: 12 minutes

Defines operations with RPG semantics on System.DateTime values.

Namespace: ASNA.QSys.Runtime Assembly: ASNA.QSys.Runtime.dll

Inheritance: Object

Methods

Signature Description
AddDateAndTime(DateTime, DateTime) Merge the date portion of a DateTime value with the time portion of another.
AddDuration(DateTime, Double, Int32, Boolean) RPG’s ADDDUR. Adds a duration span to a DateTime value.
ComputeDifference(DateTime, DateTime, Boolean) Compute the difference, in years or months, between two DateTime values.
ConvertJulianToFormattedTimeDecimal(DateTime, Int32) Convert a DateTime value to numeric in Julian format in 12 or 14 digits, according to RPG’s specifications.
ConvertJulianToNumericString(DateTime) Convert a DateTime value to a string in Julian format without separators.
ConvertJulianToString(DateTime, String) Convert a DateTime value to a string in Julian format using separators.
ConvertStampToDate(DateTime) Copy the date portion of theStamp to theDate.
ConvertStampToTime(DateTime) Copy the time portion of theStamp to theTime.
ConvertStampToUSATime(DateTime) Convert to *USA time (no seconds).
ConvertStringToJulian(String, String) Parse a string representing a Julian date with separator, returning its DateTime equivalent.
CopyDateToStamp(DateTime, DateTime) Copy theDate to the date portion of theStamp.
CopyTimeToStamp(DateTime, DateTime) Copy theTime to the time portion of theStamp.
DiffDuration(DateTime, DateTime, Int32) Subtract two DateTime objects giving the result in the specified duration.
GetCommonDate() Get the date portion of the Job startup date.
GetCommonDateTime() Get the Job startup DateTime value.
GetCommonDay() Get the Job startup day of the month.
GetCommonDayAsDecimal() Get the Job startup day of the month as a decimal.
GetCommonMonth() Get the Job startup month.
GetCommonMonthAsDecimal() Get the Job startup month as a decimal.
GetCommonYear() Get the Job startup year.
GetCommonYear2() Get the Job startup two-digit year.
GetCommonYearAsDecimal2() Get the Job startup two-digit year as a decimal.
GetCommonYearAsDecimal4() Get the Job startup year as a decimal.
GetInitialDate(DateTimeFormat) Gets the value of DATE/UDATE depending on the given format. Use the proper format to obtain either a 6 (UDATE) or an 8 (DATE) digit value.
NormalizeYY(DateTime) Normalize the year portion of a DateTime value taken as a a two-digit year to the proper year in the range 1940 - 2039.
SubtractDuration(DateTime, Double, Int32, Boolean) RPG’s SUBDUR. Subtracts a duration span from a DateTime value.
TruncToMicroseconds(DateTime) Truncate theStamp to the closest Microsecond (make it ISO format).

DateTime AddDateAndTime(DateTime date, DateTime time)

Merge the date portion of a DateTime value with the time portion of another.

DateTime AddDateAndTime(DateTime date, DateTime time)

Parameters

Type Parameter name Description
DateTime date The DateTime holding a date value.
DateTime time The DateTime holding a time value.

Returns

Type Description
DateTime The merged date/time values.

DateTime AddDuration(DateTime dateTime, double duration, int durationCode, bool justTheTime)

RPG’s ADDDUR. Adds a duration span to a DateTime value.

DateTime AddDuration(DateTime dateTime, double duration, int durationCode, bool justTheTime)

Parameters

Type Parameter name Description
DateTime dateTime The DateTime value.
Double duration The duraction span.
Int32 durationCode The duration code (see: ASNA.QSys.Runtime.DateTimeOps.DurationCode)
Boolean justTheTime True if the DateTime value represents an RPG time.

Returns

Type Description
DateTime The result of adding the specified duration to dateTime.

int ComputeDifference(DateTime dateTime1, DateTime dateTime2, bool isMonths)

Compute the difference, in years or months, between two DateTime values.

int ComputeDifference(DateTime dateTime1, DateTime dateTime2, bool isMonths)

Parameters

Type Parameter name Description
DateTime dateTime1 The minuend.
DateTime dateTime2 The subtrahend.
Boolean isMonths True to compute the difference in months.

Returns

Type Description
Int32 The difference, in years or months, between the two given DateTime values.

decimal ConvertJulianToFormattedTimeDecimal(DateTime theDateTime, int digits)

Convert a DateTime value to numeric in Julian format in 12 or 14 digits, according to RPG’s specifications.

decimal ConvertJulianToFormattedTimeDecimal(DateTime theDateTime, int digits)

Parameters

Type Parameter name Description
DateTime theDateTime The DateTime value.
Int32 digits Number of digits in the result. Must be 12 or 14.

Returns

Type Description
Decimal The decimal number representation of theDateTime in Julian format.

string ConvertJulianToNumericString(DateTime theDate)

Convert a DateTime value to a string in Julian format without separators.

string ConvertJulianToNumericString(DateTime theDate)

Parameters

Type Parameter name Description
DateTime theDate The DateTime value.

Returns

Type Description
String The string representing the date portion of theDate in Julian format without separators.

string ConvertJulianToString(DateTime theDate, string separator)

Convert a DateTime value to a string in Julian format using separators.

string ConvertJulianToString(DateTime theDate, string separator)

Parameters

Type Parameter name Description
DateTime theDate The DateTime value.
String separator The separator.

Returns

Type Description
String The string representing the date portion of theDate in Julian format using separators.

DateTime ConvertStampToDate(DateTime theStamp)

Copy the date portion of theStamp to theDate.

DateTime ConvertStampToDate(DateTime theStamp)

Parameters

Type Parameter name Description
DateTime theStamp ConvertStampToDate param .

Returns

Type Description
DateTime ConvertStampToDate returns.

DateTime ConvertStampToTime(DateTime theStamp)

Copy the time portion of theStamp to theTime.

DateTime ConvertStampToTime(DateTime theStamp)

Parameters

Type Parameter name Description
DateTime theStamp ConvertStampToTime param theStamp.

Returns

Type Description
DateTime ConvertStampToTime returns.

DateTime ConvertStampToUSATime(DateTime theStamp)

Convert to *USA time (no seconds).

DateTime ConvertStampToUSATime(DateTime theStamp)

Parameters

Type Parameter name Description
DateTime theStamp ConvertStampToUSATime param theStamp.

Returns

Type Description
DateTime ConvertStampToUSATime returns.

DateTime ConvertStringToJulian(string theString, string separator)

Parse a string representing a Julian date with separator, returning its DateTime equivalent.

DateTime ConvertStringToJulian(string theString, string separator)

Parameters

Type Parameter name Description
String theString The string representing a Julian date.
String separator The separator used in theString.

Returns

Type Description
DateTime The DateTime value equivalent to theString interpreted as a Julian date.

DateTime CopyDateToStamp(DateTime theDate, DateTime theStamp)

Copy theDate to the date portion of theStamp.

DateTime CopyDateToStamp(DateTime theDate, DateTime theStamp)

Parameters

Type Parameter name Description
DateTime theDate CopyDateToStamp param theDate.
DateTime theStamp CopyDateToStamp param theStamp.

Returns

Type Description
DateTime CopyDateToStamp returns.

DateTime CopyTimeToStamp(DateTime theTime, DateTime theStamp)

Copy theTime to the time portion of theStamp.

DateTime CopyTimeToStamp(DateTime theTime, DateTime theStamp)

Parameters

Type Parameter name Description
DateTime theTime CopyTimeToStamp param theTime.
DateTime theStamp CopyTimeToStamp param theStamp.

Returns

Type Description
DateTime CopyTimeToStamp returns.

double DiffDuration(DateTime dateTime1, DateTime dateTime2, int durationCode)

Subtract two DateTime objects giving the result in the specified duration.

double DiffDuration(DateTime dateTime1, DateTime dateTime2, int durationCode)

Parameters

Type Parameter name Description
DateTime dateTime1 The minuend.
DateTime dateTime2 The subtrahend.
Int32 durationCode The duration code, as an integer (see: ASNA.QSys.Runtime.DateTimeOps.DurationCode).

Returns

Type Description
Double The double number representing difference between the two DateTime values expressed in the given durationCode.

DateTime GetCommonDate()

Get the date portion of the Job startup date.

DateTime GetCommonDate()

DateTime GetCommonDateTime()

Get the Job startup DateTime value.

DateTime GetCommonDateTime()

int GetCommonDay()

Get the Job startup day of the month.

int GetCommonDay()

decimal GetCommonDayAsDecimal()

Get the Job startup day of the month as a decimal.

decimal GetCommonDayAsDecimal()

int GetCommonMonth()

Get the Job startup month.

int GetCommonMonth()

decimal GetCommonMonthAsDecimal()

Get the Job startup month as a decimal.

decimal GetCommonMonthAsDecimal()

int GetCommonYear()

Get the Job startup year.

int GetCommonYear()

int GetCommonYear2()

Get the Job startup two-digit year.

int GetCommonYear2()

decimal GetCommonYearAsDecimal2()

Get the Job startup two-digit year as a decimal.

decimal GetCommonYearAsDecimal2()

decimal GetCommonYearAsDecimal4()

Get the Job startup year as a decimal.

decimal GetCommonYearAsDecimal4()

decimal GetInitialDate(DateTimeFormat format)

Gets the value of DATE/UDATE depending on the given format. Use the proper format to obtain either a 6 (UDATE) or an 8 (DATE) digit value.

decimal GetInitialDate(DateTimeFormat format)

Parameters

Type Parameter name Description
DateTimeFormat format The DateTimeFormat value that represents the *DATE/UDATE value.

Returns

Type Description
Decimal The decimal number representing *DATE/UDATE for the given format.

DateTime NormalizeYY(DateTime formatDate)

Normalize the year portion of a DateTime value taken as a a two-digit year to the proper year in the range 1940 - 2039.

DateTime NormalizeYY(DateTime formatDate)

Parameters

Type Parameter name Description
DateTime formatDate The DateTime value.

Returns

Type Description
DateTime The DateTime value with the year in the 1940-2039 range.

DateTime SubtractDuration(DateTime dateTime, double duration, int durationCode, bool justTheTime)

RPG’s SUBDUR. Subtracts a duration span from a DateTime value.

DateTime SubtractDuration(DateTime dateTime, double duration, int durationCode, bool justTheTime)

Parameters

Type Parameter name Description
DateTime dateTime The DateTime value.
Double duration The duraction span.
Int32 durationCode The duration code, as an integer (see: ASNA.QSys.Runtime.DateTimeOps.DurationCode)
Boolean justTheTime True if the DateTime value represents an RPG time.

Returns

Type Description
DateTime The result of subtracting the specified duration to dateTime.

DateTime TruncToMicroseconds(DateTime theStamp)

Truncate theStamp to the closest Microsecond (make it ISO format).

DateTime TruncToMicroseconds(DateTime theStamp)

Parameters

Type Parameter name Description
DateTime theStamp TruncToMicroseconds param theStamp.

Returns

Type Description
DateTime TruncToMicroseconds returns.