Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
How to compare 2 dates
Answer
4/4/16 6:09 AM
Hello,

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:

 1
 2## Get all ontology models which exist on explorer.
 3CC "Core" GET_ALL_MODEL_VERSIONS modeltype:"Ontology Model"
 4SET ontModelVersions: (modelversionids)
 5
 6## Get all BPMN models which exist on explorer.
 7CC "Core" GET_ALL_MODEL_VERSIONS modeltype:"Business process diagram (BPMN 2.0)"
 8SET bpmnModelVersions: (modelversionids)
 9
10## For each ontology model check which was the date of its last change and save its name in a variable .
11FOR ont_id in: (ontModelVersions)
12{
13  SET ontid: (VAL ont_id)
14  CC "DB" GET_DATE_OF_LAST_CHANGE modelid: (ontid)
15  SET ontDate: (date)
16
17  ## For each BPMN model check which was the date of its last change.
18  FOR bpmn_id in: (bpmnModelVersions)
19  {
20    CC "DB" GET_DATE_OF_LAST_CHANGE modelid: (VAL bpmn_id)
21    SET bpmnDate: (date)
22  }
23
24  ## If the current ontology has been updated, created or imported after the current BPMN model
25  ## insert in an array its updated classes or all its classes if it has imported or created for first time.
26  IF(ontDate >= bpmnDate)
27  {
28    ...
29  }
30}


But i realized that this comparison (date1 >= date2) doesn't work.
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.
Any solution about it? How i can compare two dates? First the years, then the months and last the days?

RE: How to compare 2 dates
Answer
4/11/16 5:46 AM as a reply to Ioanna Ramoutsaki.
Hello,

I solved this problem making a jar file which compares the 2 dates.

With regards,
Ioanna