How to compare 2 datesHow to compare 2 datesRE: How to compare 2 datesIoanna Ramoutsakihttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=5141212016-04-11T05:46:37Z2016-04-11T05:46:37ZHello,<br /><br />I solved this problem making a jar file which compares the 2 dates.<br /><br />With regards,<br />IoannaIoanna Ramoutsaki2016-04-11T05:46:37ZHow to compare 2 datesIoanna Ramoutsakihttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=5087792016-04-04T06:09:22Z2016-04-04T06:08:26ZHello,<br /><br />I want when a new ontology is imported or created or when an already existing ontology is updated on SeMFIS tool, the tool automatically recognize it and suggest this ontology for annotations on already existing 'suitable' BPMNs models. I have written the following code snippet for this reason:<br /><br /><div class="code"><span class="code-lines"> 1</span><br /><span class="code-lines"> 2</span>## Get all ontology models which exist on explorer.<br /><span class="code-lines"> 3</span>CC "Core" GET_ALL_MODEL_VERSIONS modeltype:"Ontology Model"<br /><span class="code-lines"> 4</span>SET ontModelVersions: (modelversionids)<br /><span class="code-lines"> 5</span><br /><span class="code-lines"> 6</span>## Get all BPMN models which exist on explorer.<br /><span class="code-lines"> 7</span>CC "Core" GET_ALL_MODEL_VERSIONS modeltype:"Business process diagram (BPMN 2.0)"<br /><span class="code-lines"> 8</span>SET bpmnModelVersions: (modelversionids)<br /><span class="code-lines"> 9</span><br /><span class="code-lines">10</span>## For each ontology model check which was the date of its last change and save its name in a variable .<br /><span class="code-lines">11</span>FOR ont_id in: (ontModelVersions)<br /><span class="code-lines">12</span>{<br /><span class="code-lines">13</span> SET ontid: (VAL ont_id)<br /><span class="code-lines">14</span> CC "DB" GET_DATE_OF_LAST_CHANGE modelid: (ontid)<br /><span class="code-lines">15</span> SET ontDate: (date)<br /><span class="code-lines">16</span><br /><span class="code-lines">17</span> ## For each BPMN model check which was the date of its last change.<br /><span class="code-lines">18</span> FOR bpmn_id in: (bpmnModelVersions)<br /><span class="code-lines">19</span> {<br /><span class="code-lines">20</span> CC "DB" GET_DATE_OF_LAST_CHANGE modelid: (VAL bpmn_id)<br /><span class="code-lines">21</span> SET bpmnDate: (date) <br /><span class="code-lines">22</span> }<br /><span class="code-lines">23</span><br /><span class="code-lines">24</span> ## If the current ontology has been updated, created or imported after the current BPMN model<br /><span class="code-lines">25</span> ## insert in an array its updated classes or all its classes if it has imported or created for first time.<br /><span class="code-lines">26</span> IF(ontDate >= bpmnDate)<br /><span class="code-lines">27</span> {<br /><span class="code-lines">28</span> ...<br /><span class="code-lines">29</span> }<br /><span class="code-lines">30</span>}<br /></div><br /><br />But i realized that this comparison (date1 >= date2) doesn't work. <br />For example, if an ontology has been created on 15.03.2016,10:05:50 and a BPMN model on 02.04.2016,11:20:03, the above comparison will consider that ontology has been created later of the BPMN model maybe because of day which is later.<br />Any solution about it? How i can compare two dates? First the years, then the months and last the days?Ioanna Ramoutsaki2016-04-04T06:08:26Z