public class CoolDateFormatter extends Object
format(Date)
method returns a String that will return the right date
when parsed with parse(String)
method.
Constructor and Description |
---|
CoolDateFormatter(Locale locale)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
eraseTime(Calendar date)
Sets all time related fields of a calendar to 0 (hour, minute, second, millisecond).
|
String |
format(Date date)
Formats a date.
|
Date |
parse(String string)
Parse a string as a date.
|
public CoolDateFormatter(Locale locale)
locale
- The locale used to format the date.public String format(Date date)
date
- The date to formatparse(String)
will return the original date when called with this string as argument.public Date parse(String string) throws ParseException
string
- The string to parse.ParseException
- if the string is not a date.public static void eraseTime(Calendar date)
date
- The calendar to change.Copyright © 2022. All rights reserved.