Class DateUtilStaticExtensions
java.lang.Object
org.apache.groovy.dateutil.extensions.DateUtilStaticExtensions
public class DateUtilStaticExtensions
extends java.lang.Object
This class defines new groovy static methods which appear on normal JDK
 Date and Calendar classes inside the Groovy environment.
- 
Constructor SummaryConstructors Constructor Description DateUtilStaticExtensions()
- 
Method SummaryModifier and Type Method Description static java.util.Dateparse(java.util.Date self, java.lang.String format, java.lang.String input)Parse a String into a Date instance using the given pattern.static java.util.Dateparse(java.util.Date self, java.lang.String format, java.lang.String input, java.util.TimeZone zone)Parse a String into a Date instance using the given pattern and TimeZone.static java.util.DateparseToStringDate(java.util.Date self, java.lang.String dateToString)Parse a String matching the pattern EEE MMM dd HH:mm:ss zzz yyyy containing US-locale-constants only (e.g.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Constructor Details- 
DateUtilStaticExtensionspublic DateUtilStaticExtensions()
 
- 
- 
Method Details- 
parsepublic static java.util.Date parse(java.util.Date self, java.lang.String format, java.lang.String input) throws java.text.ParseExceptionParse a String into a Date instance using the given pattern. This convenience method acts as a wrapper forSimpleDateFormat.Note that a new SimpleDateFormat instance is created for every invocation of this method (for thread safety). - Parameters:
- self- placeholder variable used by Groovy categories; ignored for default static methods
- format- pattern used to parse the input string.
- input- String to be parsed to create the date instance
- Returns:
- a new Date instance representing the parsed input string
- Throws:
- java.text.ParseException- if there is a parse error
- Since:
- 1.5.7
- See Also:
- DateFormat.parse(java.lang.String)
 
- 
parsepublic static java.util.Date parse(java.util.Date self, java.lang.String format, java.lang.String input, java.util.TimeZone zone) throws java.text.ParseExceptionParse a String into a Date instance using the given pattern and TimeZone. This convenience method acts as a wrapper forSimpleDateFormat.Note that a new SimpleDateFormat instance is created for every invocation of this method (for thread safety). - Parameters:
- self- placeholder variable used by Groovy categories; ignored for default static methods
- format- pattern used to parse the input string.
- input- String to be parsed to create the date instance
- zone- TimeZone to use when parsing
- Returns:
- a new Date instance representing the parsed input string
- Throws:
- java.text.ParseException- if there is a parse error
- Since:
- 2.4.1
- See Also:
- DateFormat.parse(java.lang.String)
 
- 
parseToStringDatepublic static java.util.Date parseToStringDate(java.util.Date self, java.lang.String dateToString) throws java.text.ParseExceptionParse a String matching the pattern EEE MMM dd HH:mm:ss zzz yyyy containing US-locale-constants only (e.g. Sat for Saturdays). Such a string is generated by the toString method ofDateNote that a new SimpleDateFormat instance is created for every invocation of this method (for thread safety). - Parameters:
- self- placeholder variable used by Groovy categories; ignored for default static methods
- dateToString- String to be parsed to create the date instance. Must match the pattern EEE MMM dd HH:mm:ss zzz yyyy with US-locale symbols
- Returns:
- a new Date instance representing the parsed input string
- Throws:
- java.text.ParseException- if there is a parse error
- Since:
- 1.8.4
 
 
-