From a6c657dcc97872f389f667986bef34160f649d71 Mon Sep 17 00:00:00 2001 From: Harald Wolff Date: Wed, 8 Jun 2016 23:35:14 +0200 Subject: [PATCH] DateTime --- src/org/hwo/datetime/DateTime.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/org/hwo/datetime/DateTime.java b/src/org/hwo/datetime/DateTime.java index f1441e1..2b53523 100644 --- a/src/org/hwo/datetime/DateTime.java +++ b/src/org/hwo/datetime/DateTime.java @@ -1,6 +1,8 @@ package org.hwo.datetime; +import java.sql.Time; import java.sql.Timestamp; +import java.util.Calendar; public class DateTime { @@ -36,6 +38,13 @@ public class DateTime { this.date = source.getDate().Clone(); this.time = new TimeOfDay(source.getTime()); } + + static public DateTime NOW(){ + Calendar calendar = Calendar.getInstance(); + Timestamp ts = new Timestamp(calendar.getTimeInMillis()); + + return new DateTime(ts); + } public int compare(DateTime comp){ int dc = this.date.compare(comp.getDate());