Class Convert
- java.lang.Object
-
- com.github.lgooddatepicker.zinternaltools.Convert
-
public class Convert extends java.lang.Object
Convert, This class allows the programmer to get or set a date picker date, using some other popular data types besides the default java.time.LocalDate. Example Usage:// Create a date picker. DatePicker datePicker = new DatePicker(); // Set the date picker date, from a java.util.Date instance, using the default time zone. java.util.Date date = new java.util.Date(); datePicker.convert().setDateWithDefaultZone(date); // Get the date picker date, as a java.util.Date instance, using the default time zone. date = datePicker.convert().getDateWithDefaultZone();
Implementation note: For code clarity, only the java.time packages should use import statements in this class. All other date related data types should be fully qualified in this class.
-
-
Constructor Summary
Constructors Constructor Description Convert(DatePicker parentDatePicker)
Default Constructor, Supply the date picker that should be associated with this converter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Date
getDateWithDefaultZone()
getDateWithDefaultZone, Returns the date picker value as a java.util.Date that was created using the system default time zone, or returns null.java.util.Date
getDateWithZone(java.time.ZoneId timezone)
getDateWithZone, Returns the date picker value as a java.util.Date that was created using the specified time zone, or returns null.void
setDateWithDefaultZone(java.util.Date javaUtilDate)
setDateWithDefaultZone, Sets the date picker value from a java.util.Date using the system default time zone.void
setDateWithZone(java.util.Date javaUtilDate, java.time.ZoneId timezone)
setDateWithZone, Sets the date picker value from a java.util.Date using the specified time zone.
-
-
-
Constructor Detail
-
Convert
public Convert(DatePicker parentDatePicker)
Default Constructor, Supply the date picker that should be associated with this converter.
-
-
Method Detail
-
getDateWithDefaultZone
public java.util.Date getDateWithDefaultZone()
getDateWithDefaultZone, Returns the date picker value as a java.util.Date that was created using the system default time zone, or returns null. This will return null when the date picker has no value.
-
getDateWithZone
public java.util.Date getDateWithZone(java.time.ZoneId timezone)
getDateWithZone, Returns the date picker value as a java.util.Date that was created using the specified time zone, or returns null. This will return null if either the date picker has no value, or if the supplied time zone was null.
-
setDateWithDefaultZone
public void setDateWithDefaultZone(java.util.Date javaUtilDate)
setDateWithDefaultZone, Sets the date picker value from a java.util.Date using the system default time zone. If either the date or the time zone are null, the date picker will be cleared.
-
setDateWithZone
public void setDateWithZone(java.util.Date javaUtilDate, java.time.ZoneId timezone)
setDateWithZone, Sets the date picker value from a java.util.Date using the specified time zone. If either the date or the time zone are null, the date picker will be cleared.
-
-