-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#117 implemented mapper for migration legacy data from sql to nosql. …
…Migration isn't implemented right now.
- Loading branch information
rinkesj
committed
Jun 21, 2015
1 parent
dc928b9
commit 7fad9d4
Showing
9 changed files
with
594 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/cz/zcu/kiv/eegdatabase/wui/components/utils/DateUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package cz.zcu.kiv.eegdatabase.wui.components.utils; | ||
|
||
import java.sql.Timestamp; | ||
|
||
import com.ibm.icu.util.Calendar; | ||
|
||
import cz.zcu.kiv.eegdatabase.data.pojo.Person; | ||
|
||
public class DateUtils { | ||
|
||
public static int getPersonAge(Person per, Timestamp scenarioStartTime) { | ||
Calendar toTime = Calendar.getInstance(); | ||
toTime.setTimeInMillis(scenarioStartTime.getTime()); | ||
|
||
Calendar birthDate = Calendar.getInstance(); | ||
birthDate.setTimeInMillis(per.getDateOfBirth().getTime()); | ||
|
||
int years = toTime.get(Calendar.YEAR) - birthDate.get(Calendar.YEAR); | ||
int currMonth = toTime.get(Calendar.MONTH) + 1; | ||
int birthMonth = birthDate.get(Calendar.MONTH) + 1; | ||
int months = currMonth - birthMonth; | ||
|
||
if (months < 0) | ||
years--; | ||
return years; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.