to.etc.util
Class CalculationUtil

java.lang.Object
  extended by to.etc.util.CalculationUtil

public class CalculationUtil
extends java.lang.Object


Method Summary
static int age(java.util.Date d)
           
static int ageOn(java.util.Date today, java.util.Date birthdate)
          Calculates the age of something on a specified date.
static java.math.BigDecimal convertToMoney(java.util.Locale loc, java.lang.String s)
          Convert to a monetary amount.
static java.lang.String convertToMoneyString(java.util.Locale loc, java.math.BigDecimal n, boolean dofraction, boolean addmonetary)
           
static java.util.Date date(java.lang.String str)
          Convert a date string in the format yyyy mm dd (with any separators) to a date value.
static java.util.Date dutchDate(java.lang.String s)
          Converts a string to a java.util.Date object.
static java.util.Date dutchDateRAW(java.lang.String s)
          Converts a string to a java.util.Date object.
static java.lang.String[] getDutchMonthShorts()
           
static boolean isFutureDate(java.util.Date a)
           
static void main(java.lang.String[] args)
           
static java.util.Date makeDate(int year, int month, int day)
           
static java.util.Date makeDateRAW(int year, int month, int day)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDutchMonthShorts

public static final java.lang.String[] getDutchMonthShorts()

ageOn

public static int ageOn(java.util.Date today,
                        java.util.Date birthdate)
Calculates the age of something on a specified date.

Parameters:
today -
birthdate -
Returns:
Throws:
java.lang.Exception

age

public static int age(java.util.Date d)

date

public static java.util.Date date(java.lang.String str)
                           throws java.lang.Exception
Convert a date string in the format yyyy mm dd (with any separators) to a date value. Throw an exception on error. This uses numeric dates only.

Parameters:
str -
Returns:
Throws:
java.lang.Exception

dutchDate

public static java.util.Date dutchDate(java.lang.String s)
                                throws java.lang.Exception
Converts a string to a java.util.Date object.

Throws:
java.lang.Exception

dutchDateRAW

public static java.util.Date dutchDateRAW(java.lang.String s)
Converts a string to a java.util.Date object.


makeDate

public static java.util.Date makeDate(int year,
                                      int month,
                                      int day)
                               throws java.lang.Exception
Throws:
java.lang.Exception

makeDateRAW

public static java.util.Date makeDateRAW(int year,
                                         int month,
                                         int day)

isFutureDate

public static boolean isFutureDate(java.util.Date a)

convertToMoney

public static java.math.BigDecimal convertToMoney(java.util.Locale loc,
                                                  java.lang.String s)
                                           throws javax.servlet.jsp.el.ELException
Convert to a monetary amount. This uses lenient parsing and allows for both a currency sign before or after and numeric separators. The currency indicators are just skipped; the thousand separators, when present, must be valid to prevent problems with replacing decimal point and comma.

Parameters:
loc -
s -
Returns:
Throws:
javax.servlet.jsp.el.ELException

convertToMoneyString

public static java.lang.String convertToMoneyString(java.util.Locale loc,
                                                    java.math.BigDecimal n,
                                                    boolean dofraction,
                                                    boolean addmonetary)

main

public static void main(java.lang.String[] args)