Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

edu.virtualschool.jwaa.TimeUtil Class Reference

List of all members.

Detailed Description

Time utilities Copyright 2002 by Brad Cox: <bcox@virtualschool.edu>

Definition at line 12 of file TimeUtil.java.

Static Public Member Functions

final long[] asMonthRange (Date date)
final Timestamp now ()
final Timestamp addDays (Timestamp date, long days)
final long daysSince (Timestamp date)


Member Function Documentation

final long [] edu.virtualschool.jwaa.TimeUtil.asMonthRange Date  date  )  [static]
 

Return a long[] whose first element is the first msec and whose second is the last msec in the current month.

Returns:
long[]
Parameters:
date Date

Definition at line 21 of file TimeUtil.java.

00022   {
00023     Calendar cal = GregorianCalendar.getInstance();
00024     cal.setTime(date);
00025     cal.set(Calendar.DAY_OF_MONTH, 1);
00026     cal.set(Calendar.HOUR, 0);
00027     cal.set(Calendar.MINUTE, 0);
00028     cal.set(Calendar.SECOND, 1);
00029     cal.set(Calendar.AM_PM, 0);
00030     
00031     long[] range = new long[2];
00032     range[0] = cal.getTime().getTime();
00033     
00034     cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) + 1);
00035     range[1] = cal.getTime().getTime();
00036     
00037     return range;
00038   }


The documentation for this class was generated from the following file: