Normalizes a single date time value by replacing any parts that are UNKNOWN or EMPTY with the maximum value for that part.
Syntax
_NormalizeDateToMax(dateToNormalize)
Parameters
Parameters for _NormalizeDateToMax(Date)
Parameter |
Definition |
Data type |
---|---|---|
dateToNormalize |
The date time to normalize. |
PFDateTime |
Returns
A new date time with all UNKNOWN or EMPTY parts replaced with their respective maximum values:
Notes
The _NormalizeDateToMax function accounts for leap years and returns the correct number of days in February of any year.
Example
The requirement in this example is to find the duration of a previous disease by subtracting the disease start date from the disease end date in the medical history. An unknown month and day are allowed for both start date and end date. An additional requirement is to substitute unknown date parts with the earliest number for start date and with the latest number for end date so that the longest possible duration of disease is assumed.
To accomplish this:
_GetDateDifference(
_NormalizeDateToMax(this.EVTEND.Value),
_NormalizeDate(this.EVTSTART.Value, new DateTime(1,1,1)),
DateTimeParts.Days)
Sample returned values
Sample returned values |
||
---|---|---|
Start date |
End date |
Returned value |
Feb 02, 2008 |
Oct 13, 2008 |
254 days |
Feb UNK, 2008 |
Oct UNK, 2008 |
273 days. The start date is converted to Feb 1, 2008, and the end date is converted to Oct 31, 2008. |
UNK UNK, 2008 |
UNK UNK, 2008 |
365 days. The start date is converted to Jan 1, 2008, and the end date is converted to Dec 31, 2008 |
Copyright © 2013, 2016 Oracle and/or its affiliates. All rights reserved.