KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sessionsystem > DateTimeFunctions


1 package com.daffodilwoods.daffodildb.server.sessionsystem;
2 import com.daffodilwoods.database.resource.*;
3 import java.io.Serializable JavaDoc;
4 import java.sql.*;
5
6 public class DateTimeFunctions implements Serializable JavaDoc
7 {
8   Timestamp timeStamp;
9
10   /**
11    * DateTimeFunction() sets a Time Stamp with currnet time in milli seconds
12  */

13
14   public DateTimeFunctions() {
15         timeStamp = new Timestamp(System.currentTimeMillis());
16   }
17
18  /**
19   * sets the Time Stamp to current time in milli seconds.
20  */

21
22   public void setCurrentTime() throws DException {
23         timeStamp.setTime(System.currentTimeMillis());
24   }
25
26  /**
27   * Returns the current Date.
28  */

29
30   public Date getDate() throws DException {
31         return new com.daffodilwoods.daffodildb.utils.DBDate(timeStamp.getTime());
32   }
33
34   /**
35    * Returns the current Month.
36   */

37
38   public int getMonth() throws DException {
39         return timeStamp.getMonth();
40   }
41
42   /**
43    Returns the current Year.
44  */

45
46   public int getYear() throws DException {
47         return timeStamp.getYear();
48   }
49
50   /**
51    * Returns the current hour.
52   */

53
54   public int getHour() throws DException {
55         return timeStamp.getHours();
56   }
57
58   /**
59    * Returns the current minutes.
60   */

61
62   public int getMinutes() throws DException {
63         return timeStamp.getMinutes();
64   }
65
66   /**
67    * Returns the current Second.
68   */

69
70   public int getSeconds() throws DException {
71         return timeStamp.getSeconds();
72   }
73   public Time getTime() throws DException {
74    return new Time(timeStamp.getTime());
75   }
76   public java.sql.Timestamp JavaDoc getTimeStamp( ) throws DException {
77     return timeStamp;
78   }
79   public void resetTransactionDate(){
80   timeStamp = new Timestamp(System.currentTimeMillis());
81    }
82
83 }
84
Popular Tags