Time interval taglib ver. 1.5


    Custom JSP taglib. This taglib lets you calculate time intervals. For example:
 


<%@ taglib uri="taglib.tld" prefix="get" %>

<%
  String s1="01/08/2002";
  String s2="07/09/2002";
%>
<get:timeInterval from="<%=s1%>" to="<%=s2%>" unit="day"/>

Two parameters (from and to) describe your dates. You may use here java.uti.Date, java.util.Calendar or just a simple string in format dd/mm/yyyy where dd describes a day, mm describes a month and yyyy describes a year. You can calculate intervals in minutes, hours, days or workdays (days excluding Sunday and Saturday). Parameter unit describes how to calculate this interval. E.g.:
 


<%
  String lastDay="31/12/2009";
%>
Time left till New Year is: <get:timeInterval to="<%=lastDay%>" /> days

Tags are:

timeInterval

Calculates time interval between two dates. Parameters are:

1) from Optional paramter. Describes a 'from' date. By default is a current date.
2) to Describes a 'to' date
3) unit Optional parameter. Describes an unit for time interval. Possible values are min, hour, day, workday, full. Default value is day.
4) id Optional parameter. Describes a page scope variable for the result (type is java.lang.String). Without this parameter tag just prints data.

for downloading:

Library: tdifftag.jar    Description: taglib.tld

© Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.

Also in Coldtags: