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());