de.webdings.tools.time

Class TimeSince


public class TimeSince
extends java.lang.Object

TimeSince is used to tell how much time has passed between two points in time.

Version:
1.0 23.05.2005

Author:
Stefan Thesing
Website: http://www.webdings.de

Method Summary

int[]
getDaysMonthsYearsSince(GregorianCalendar start)
Returns the timespan between 1.
int[]
getDaysMonthsYearsSince(GregorianCalendar start, GregorianCalendar stop)
Returns the timespan between two specified points in time as an array containing
IndexInformation
0full years
1full months
2full days
String
getDaysMonthsYearsSinceAsString(GregorianCalendar start)
Returns the timespan between 1.
String
getDaysMonthsYearsSinceAsString(GregorianCalendar start, GregorianCalendar stop)
Returns the timespan between two specified points in time as a String in the following form:

42 years, 5 months, 23 days

int
getDaysSince(GregorianCalendar start)
Returns the timespan between 1.
int
getDaysSince(GregorianCalendar start, GregorianCalendar stop)
Returns the timespan between two specified points in time in full days
long
getHoursSince(GregorianCalendar start)
Returns the timespan between 1.
long
getHoursSince(GregorianCalendar start, GregorianCalendar stop)
Returns the timespan between two specified points in time in full hours
long
getMilliSecondsSince(GregorianCalendar start)
Returns the timespan between 1.
long
getMilliSecondsSince(GregorianCalendar start, GregorianCalendar stop)
Returns the timespan between two points in time in full milliseconds.
long
getMinutesSince(GregorianCalendar start)
Returns the timespan between 1.
long
getMinutesSince(GregorianCalendar start, GregorianCalendar stop)
Returns the timespan between two specified points in time in full minutes
int
getMonthsSince(GregorianCalendar start)
Returns the timespan between 1.
int
getMonthsSince(GregorianCalendar start, GregorianCalendar stop)
Returns the timespan between two specified points in time in full months
long
getSecondsSince(GregorianCalendar start)
Returns the timespan between 1.
long
getSecondsSince(GregorianCalendar start, GregorianCalendar stop)
Returns the timespan between two specified points in time in full seconds.
int
getWeeksSince(GregorianCalendar start)
Returns the timespan between 1.
int
getWeeksSince(GregorianCalendar start, GregorianCalendar stop)
Returns the timespan between two specified points in time in full weeks
int
getYearsSince(GregorianCalendar start)
Returns the timespan between 1.
int
getYearsSince(GregorianCalendar start, GregorianCalendar stop)
Returns the timespan between two specified points in time in full years

Method Details

getDaysMonthsYearsSince

public int[] getDaysMonthsYearsSince(GregorianCalendar start)
Returns the timespan between 1. a specified past point of time and
2. the moment this method is called (now) as an array containing
IndexInformation
0full years
1full months
2full days

Parameters:
start - past point

Returns:
Time-span in full years, full months, full days as an array containing ints.


getDaysMonthsYearsSince

public int[] getDaysMonthsYearsSince(GregorianCalendar start,
                                     GregorianCalendar stop)
Returns the timespan between two specified points in time as an array containing
IndexInformation
0full years
1full months
2full days

Parameters:
start - Beginning of the measured time-span.
stop - End of the measured time-span.

Returns:
Time-span in full years, full months, full days as an array containing ints.


getDaysMonthsYearsSinceAsString

public String getDaysMonthsYearsSinceAsString(GregorianCalendar start)
Returns the timespan between 1. a specified past point of time and
2. the moment this method is called (now) as a String in the following form:

42 years, 5 months, 23 days

Parameters:
start - past point

Returns:
Time-span in full years, full months and full days as a String


getDaysMonthsYearsSinceAsString

public String getDaysMonthsYearsSinceAsString(GregorianCalendar start,
                                              GregorianCalendar stop)
Returns the timespan between two specified points in time as a String in the following form:

42 years, 5 months, 23 days

Parameters:
start - Beginning of the measured time-span.
stop - End of the measured time-span.

Returns:
Time-span in full years, full months and full days as a String


getDaysSince

public int getDaysSince(GregorianCalendar start)
Returns the timespan between 1. a specified past point of time and
2. the moment this method is called (now) in full days

Parameters:
start - past point

Returns:
Time-span in full days


getDaysSince

public int getDaysSince(GregorianCalendar start,
                        GregorianCalendar stop)
Returns the timespan between two specified points in time in full days

Parameters:
start - Beginning of the measured time-span.
stop - End of the measured time-span.

Returns:
Time-span in full days


getHoursSince

public long getHoursSince(GregorianCalendar start)
Returns the timespan between 1. a specified past point of time and
2. the moment this method is called (now) in full hours

Parameters:
start - past point

Returns:
Time-span in full hours


getHoursSince

public long getHoursSince(GregorianCalendar start,
                          GregorianCalendar stop)
Returns the timespan between two specified points in time in full hours

Parameters:
start - Beginning of the measured time-span.
stop - End of the measured time-span.

Returns:
Time-span in full hours


getMilliSecondsSince

public long getMilliSecondsSince(GregorianCalendar start)
Returns the timespan between 1. a specified past point of time and
2. the moment this method is called (now) in full milliseconds

Parameters:
start - past point

Returns:
Time-span in full milliseconds


getMilliSecondsSince

public long getMilliSecondsSince(GregorianCalendar start,
                                 GregorianCalendar stop)
Returns the timespan between two points in time in full milliseconds.

Parameters:
start - Beginning of the measured time-span.
stop - End of the measured time-span.

Returns:
Time-span in full milliseconds


getMinutesSince

public long getMinutesSince(GregorianCalendar start)
Returns the timespan between 1. a specified past point of time and
2. the moment this method is called (now) in full minutes

Parameters:
start - past point

Returns:
Time-span in full minutes


getMinutesSince

public long getMinutesSince(GregorianCalendar start,
                            GregorianCalendar stop)
Returns the timespan between two specified points in time in full minutes

Parameters:
start - Beginning of the measured time-span.
stop - End of the measured time-span.

Returns:
Time-span in full minutes


getMonthsSince

public int getMonthsSince(GregorianCalendar start)
Returns the timespan between 1. a specified past point of time and
2. the moment this method is called (now) in full months

Parameters:
start - past point

Returns:
Time-span in full months


getMonthsSince

public int getMonthsSince(GregorianCalendar start,
                          GregorianCalendar stop)
Returns the timespan between two specified points in time in full months

Parameters:
start - Beginning of the measured time-span.
stop - End of the measured time-span.

Returns:
Time-span in full months


getSecondsSince

public long getSecondsSince(GregorianCalendar start)
Returns the timespan between 1. a specified past point of time and
2. the moment this method is called (now) in full seconds

Parameters:
start - past point

Returns:
Time-span in full seconds


getSecondsSince

public long getSecondsSince(GregorianCalendar start,
                            GregorianCalendar stop)
Returns the timespan between two specified points in time in full seconds.

Parameters:
start - Beginning of the measured time-span.
stop - End of the measured time-span.

Returns:
Time-span in full seconds


getWeeksSince

public int getWeeksSince(GregorianCalendar start)
Returns the timespan between 1. a specified past point of time and
2. the moment this method is called (now) in full weeks

Parameters:
start - past point

Returns:
Time-span in full weeks


getWeeksSince

public int getWeeksSince(GregorianCalendar start,
                         GregorianCalendar stop)
Returns the timespan between two specified points in time in full weeks

Parameters:
start - Beginning of the measured time-span.
stop - End of the measured time-span.

Returns:
Time-span in full weeks


getYearsSince

public int getYearsSince(GregorianCalendar start)
Returns the timespan between 1. a specified past point of time and
2. the moment this method is called (now) in full years

Parameters:
start - past point

Returns:
Time-span in full years


getYearsSince

public int getYearsSince(GregorianCalendar start,
                         GregorianCalendar stop)
Returns the timespan between two specified points in time in full years

Parameters:
start - Beginning of the measured time-span.
stop - End of the measured time-span.

Returns:
Time-span in full years


TimeSince.java - Copyright (c) 2005 by Stefan Thesing

This file is part of Webdings Tools.

Webdings Tools is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Webdings Tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Webdings Tools; if not, write to the
Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA



© 2005 by Stefan Thesing;
Verbatim copying and redistribution of this entire page are permitted provided this notice is preserved.