001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/util/tags/sakai_2-4-1/util-api/api/src/java/org/sakaiproject/time/api/Time.java $
003: * $Id: Time.java 20981 2007-02-03 16:57:45Z csev@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.time.api;
021:
022: import java.io.Serializable;
023:
024: /**
025: * <p>
026: * Time ...
027: * </p>
028: */
029: public interface Time extends Cloneable, Comparable, Serializable {
030: /**
031: * Format as a string, GMT, for a SQL statement.
032: *
033: * @return Time in string format.
034: */
035: String toStringSql();
036:
037: /**
038: * Format as a string, Local time zone.
039: *
040: * @return Time in string format.
041: */
042: String toStringLocal();
043:
044: /**
045: * Format as a string, Human Readable, full format, GMT.
046: *
047: * @return Time in string format.
048: */
049: String toStringGmtFull();
050:
051: /**
052: * Format as a string, Human Readable, full format, Local.
053: *
054: * @return Time in string format.
055: */
056: String toStringLocalFull();
057:
058: /**
059: * Format as a string, Human Readable, full format, Local, with zone.
060: *
061: * @return Time in string format.
062: */
063: String toStringLocalFullZ();
064:
065: /**
066: * Format as a string, Human Readable, short (time only) format, GMT.
067: *
068: * @return Time in string format.
069: */
070: String toStringGmtShort();
071:
072: /**
073: * Format as a string, Human Readable, short (time only) format, Local.
074: *
075: * @return Time in string format.
076: */
077: String toStringLocalShort();
078:
079: /**
080: * Format as a string, Human Readable, time only format, GMT.
081: *
082: * @return Time in string format.
083: */
084: String toStringGmtTime();
085:
086: /**
087: * Format as a string, Human Readable, time only format, Local.
088: *
089: * @return Time in string format.
090: */
091: String toStringLocalTime();
092:
093: /**
094: * Format as a string, Human Readable, time only format, 24hour Local.
095: *
096: * @return Time in string format.
097: */
098: String toStringLocalTime24();
099:
100: /**
101: * Format as a string, Human Readable, time only format, Local, with zone.
102: *
103: * @return Time in string format.
104: */
105: String toStringLocalTimeZ();
106:
107: /**
108: * Format as a string, Human Readable, date only format, GMT.
109: *
110: * @return Time in string format.
111: */
112: String toStringGmtDate();
113:
114: /**
115: * Format as a string, Human Readable, date only format, Local.
116: *
117: * @return Time in string format.
118: */
119: String toStringLocalDate();
120:
121: /**
122: * Format as a string, short format: MM/DD/YY, Local.
123: *
124: * @return Time in string format.
125: */
126: String toStringLocalShortDate();
127:
128: /**
129: * Format as a string, RFC822 format:
130: * Sun, 14 Aug 2005 16:13:03 UTC.
131: *
132: * http://www.w3.org/Protocols/rfc822/
133: *
134: * @return Time in string format per RFC822.
135: */
136: String toStringRFC822Local();
137:
138: /**
139: * Format as a file path based on the date and time.
140: *
141: * @return Time is string format.
142: */
143: String toStringFilePath();
144:
145: /**
146: * Set the time in milliseconds since.
147: *
148: * @param value
149: * The milliseconds since value for the time.
150: */
151: void setTime(long value);
152:
153: /**
154: * Access the milliseconds since.
155: *
156: * @return The milliseconds since value.
157: */
158: long getTime();
159:
160: /**
161: * Is this time before the other time?
162: *
163: * @param other
164: * The other time for the comparison.
165: * @return true if this time is before the other, false if not.
166: */
167: boolean before(Time other);
168:
169: /**
170: * Is this time after the other time?
171: *
172: * @param other
173: * The other time for the comparison.
174: * @return true if this time is after the other, false if not.
175: */
176: boolean after(Time other);
177:
178: /**
179: * Make a clone.
180: *
181: * @return The clone.
182: */
183: Object clone();
184:
185: /**
186: * Access the time value as a TimeBreakdown object, in GMT
187: *
188: * @return A TimeBreakdown object representing this time's value in GMT
189: */
190: TimeBreakdown breakdownGmt();
191:
192: /**
193: * Access the time value as a TimeBreakdown object, in Local
194: *
195: * @return A TimeBreakdown object representing this time's value in GMT
196: */
197: TimeBreakdown breakdownLocal();
198:
199: /**
200: * Access the time in a common human readable display format
201: *
202: * @return The time string in human readable format.
203: */
204: String getDisplay();
205: }
|