Page last modified 12:16, 29 May 2018 by villes

.plusHours() / .plusMinutes() / .plusSeconds() Redirected from User Guides/myXML/5: OCL Rules/Available methods for OCL base types/.plusHours() / .plusMinutes() / .plusSeconds()

    Table of contents

    Description of the method

     

    Description: .plus{Hours|Minutes|Seconds}() method adds as many of hours or minutes or seconds as the integer in the parameter indicates.
    Available for: ISO Date Time
    Parameters: integer
    Return type: ISO Date Time

     

    Example

    Context: HeaderType1 
    OCL: self.TimeStamp.plusHours(2) = self.Dt
    Description: The example rule compares the date & time of <TimeStamp> plus 2 hours to the date & time of <Dt>. If the date & time of <TimeStamp> after the additional hours equals the date & time of <Dt>, true will be returned. This works in the same way with minutes and seconds.

     

    The XML snippet below would pass this check.

    <Header>
        <Dt>2018-05-28T14:17:50</Dt>
        <TimeStamp>2018-05-28T12:17:50</TimeStamp>
    </Header>

    The other snippet below however would not pass this check.

    <Header>
        <Dt>2018-05-28T08:17:50</Dt>
        <TimeStamp>2018-05-28T12:17:50</TimeStamp>
    </Header>

    Menu