public class DateUtils extends Object
Modifier and Type | Method and Description |
---|---|
static Date |
addDate(Date date,
int years,
int months,
int days)
Calculates a date relative to the supplied date.
|
static String |
formatDate(Date d,
Locale locale) |
static String |
formatDayOfWeek(Date d,
Locale locale,
boolean longFormat) |
static String |
formatMonth(Date d,
Locale locale,
boolean longFormat) |
static String |
formatMonth(int month,
Locale locale,
boolean longFormat) |
static String |
formatTime(Date d,
Locale locale,
boolean withSeconds) |
static String |
formatYear(Date d,
Locale locale) |
static Date |
getDate(int year,
int month,
int day) |
static Date |
getDateNow()
Returns the current date without time
|
static Date |
getDateOnly(Date date) |
static Date |
getTimeNow()
Returns the current date and time
|
static int |
getWeekOfYear(Date d,
Locale locale) |
static Date |
parseDate(String sDate,
Locale locale) |
static Date |
setDate(Date date,
int year,
int month,
int day) |
static Date |
setTime(Date date,
int hours,
int minutes,
int seconds,
int millis) |
public static Date getDateNow()
public static Date getTimeNow()
public static Date addDate(Date date, int years, int months, int days)
date
- date to calculate fromyears
- number of years to add or subtract from the supplied datemonths
- number of months to add or subtract from the supplied datedays
- number of days to add or subtract from the supplied datepublic static Date getDate(int year, int month, int day)
Copyright © 2008–2018 Apache Software Foundation. All rights reserved.