org.jfree.formula.util

Class DateUtil


public class DateUtil
extends java.lang.Object

Author:
Cedric Pronzato

Method Summary

static Calendar
createCalendar(Date date, LocalizationContext context)
static java.sql.Date
createDate(int year, int month, int day, LocalizationContext context)
static Date
createDateTime(int year, int month, int day, int hour, int minute, int second, LocalizationContext context)
static Time
createTime(int hour, int minute, int second, LocalizationContext context)
static void
main(String[] args)
static Date
normalizeDate(Date fromDate, Type toType)
Converts a Date value according to the requested Type to the proper Date subclasses (java.sql.Time, java.sql.Date) if needed.
static Date
normalizeDate(Date fromDate, Type toType, boolean convertSerial)
static Number
normalizeDate(Number fromSerialDate, Type toType)
static Date
now(LocalizationContext context)
static Date
toJavaDate(Number serialDate, LocalizationContext context)
static Number
toSerialDate(Date date, LocalizationContext context)

Method Details

createCalendar

public static Calendar createCalendar(Date date,
                                      LocalizationContext context)

createDate

public static java.sql.Date createDate(int year,
                                       int month,
                                       int day,
                                       LocalizationContext context)

createDateTime

public static Date createDateTime(int year,
                                  int month,
                                  int day,
                                  int hour,
                                  int minute,
                                  int second,
                                  LocalizationContext context)

createTime

public static Time createTime(int hour,
                              int minute,
                              int second,
                              LocalizationContext context)

main

public static void main(String[] args)

normalizeDate

public static Date normalizeDate(Date fromDate,
                                 Type toType)
Converts a Date value according to the requested Type to the proper Date subclasses (java.sql.Time, java.sql.Date) if needed. If the requested type is unknown, no conversion takes place and the input date is returned.
Parameters:
fromDate - The date to convert.
toType - The requested type of date.
Returns:
The converted date.

normalizeDate

public static Date normalizeDate(Date fromDate,
                                 Type toType,
                                 boolean convertSerial)

normalizeDate

public static Number normalizeDate(Number fromSerialDate,
                                   Type toType)

now

public static Date now(LocalizationContext context)

toJavaDate

public static Date toJavaDate(Number serialDate,
                              LocalizationContext context)

toSerialDate

public static Number toSerialDate(Date date,
                                  LocalizationContext context)