diff options
author | Alexander Marsalek <amarsalek@iaik.tugraz.at> | 2014-06-04 18:50:50 +0200 |
---|---|---|
committer | Alexander Marsalek <amarsalek@iaik.tugraz.at> | 2014-06-04 18:56:07 +0200 |
commit | f81b3716ac27094ab1845668cb38a1fe6a2d5f8c (patch) | |
tree | 933cd9ae96e6c7c01b78aea37b904b31419b1b0f /DocumentService/src/eu/stork/documentservice/data/DatabaseHelper.java | |
parent | 31c8bad4214bfee45eef0ca98faf3f6f32fe5b23 (diff) | |
download | moa-id-spss-f81b3716ac27094ab1845668cb38a1fe6a2d5f8c.tar.gz moa-id-spss-f81b3716ac27094ab1845668cb38a1fe6a2d5f8c.tar.bz2 moa-id-spss-f81b3716ac27094ab1845668cb38a1fe6a2d5f8c.zip |
added DocumentService
Diffstat (limited to 'DocumentService/src/eu/stork/documentservice/data/DatabaseHelper.java')
-rw-r--r-- | DocumentService/src/eu/stork/documentservice/data/DatabaseHelper.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/DocumentService/src/eu/stork/documentservice/data/DatabaseHelper.java b/DocumentService/src/eu/stork/documentservice/data/DatabaseHelper.java new file mode 100644 index 000000000..07c25aeba --- /dev/null +++ b/DocumentService/src/eu/stork/documentservice/data/DatabaseHelper.java @@ -0,0 +1,37 @@ +package eu.stork.documentservice.data; + +public class DatabaseHelper { + /** + * Get the current timestamp in SQL timestamp + * @return the current time in sql timestamp + */ + public static java.sql.Timestamp getSqlCurrentDate() { + java.util.Date today = new java.util.Date(); + return new java.sql.Timestamp(today.getTime()); + } + + /** + * Convert Java Date to SQL timestamp + * @param date the date to convert + * @return the date in sql timestamp + */ + public static java.sql.Timestamp getSqlDate(java.util.Date date) { + if (date != null) + return new java.sql.Timestamp(date.getTime()); + else + return null; + } + + /** + * Convert SQL timestamp to Java Date + * @param time the timestamp to concert + * @return the time in util date + */ + public static java.util.Date getUtilDate(java.sql.Timestamp time) { + if (time != null) + return new java.util.Date(time.getTime()); + else + return null; + } + +} |