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). |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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 GetCommonDateTime()
Get the Job startup DateTime value.
DateTime GetCommonDateTime()
int GetCommonDay()
Get the Job startup day of the month.
decimal GetCommonDayAsDecimal()
Get the Job startup day of the month as a decimal.
decimal GetCommonDayAsDecimal()
int GetCommonMonth()
Get the Job startup month.
decimal GetCommonMonthAsDecimal()
Get the Job startup month as a decimal.
decimal GetCommonMonthAsDecimal()
int GetCommonYear()
Get the Job startup year.
int GetCommonYear2()
Get the Job startup two-digit year.
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()
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. |
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. |
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. |
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. |