aboutsummaryrefslogtreecommitdiff
path: root/DocumentService/src/eu/stork/documentservice/data/DatabaseHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'DocumentService/src/eu/stork/documentservice/data/DatabaseHelper.java')
-rw-r--r--DocumentService/src/eu/stork/documentservice/data/DatabaseHelper.java37
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;
+ }
+
+}