.toDate()
Table of contents
Description of the method
Description: | .toDate() method converts a string to date. After converting to date, the date methods are available. |
Available for: | string |
Parameters: | - |
Return type: | date |
Example
Context: | HeaderType1 |
OCL: | self.InstrId.size() = 35 implies ( let s1 : string = self.InstrId.substring(0,4) in let s2 : string = self.InstrId.substring(4,6) in let s3 : string = self.InstrId.substring(6,8) in let sAll : string = s1+"-"+s2+"-"+s3 in ( sAll.toDate().allowedDaysInFuture(2) and sAll.toDate().allowedDaysInPast(2) ) ) |
Description: | The example rule converts <Id> element value to a date and checks that the date is within 2 days into future or past |
Assuming current date is 2018-05-22, the XML snippet below would pass this check.
<InstrId>2018052312345678901BRRRR00000000001</InstrId> |
The other snippet below however would not pass this check.
<InstrId>2017052312345678901BRRRR00000000001</InstrId> |