java.lang.Object
records.util.Convert
Utility class for converting between different data types and formats.
Available methods:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LocalDate
DateToLocalDate
(Date date) Converts a java.util.Date object to java.time.LocalDate.static String
doubleToString
(Double value) Converts a Double value to a string with two decimal places.static String
MonthValueToString
(int value) Converts a month value to a string with two digits.static double
roundToTwoDecimalPlaces
(double value) Rounds a double value to two decimal places.static Double
StringToDouble
(String value) Converts a string to a Double value.static LocalDate
Converts a string in "yyyy-MM-dd" format to LocalDate.static LocalTime
StringToLocalTime
(String time) Converts a string representing time to LocalTime.
-
Constructor Details
-
Convert
public Convert()
-
-
Method Details
-
DateToLocalDate
Converts a java.util.Date object to java.time.LocalDate.- Parameters:
date
- the Date object to convert- Returns:
- the corresponding LocalDate object
-
StringToLocalDate_yyyyMMdd
Converts a string in "yyyy-MM-dd" format to LocalDate.- Parameters:
date
- the string representing the date- Returns:
- the corresponding LocalDate object
-
StringToLocalTime
Converts a string representing time to LocalTime.- Parameters:
time
- the string representing the time- Returns:
- the corresponding LocalTime object
-
doubleToString
Converts a Double value to a string with two decimal places.- Parameters:
value
- the Double value to convert- Returns:
- the formatted string
-
StringToDouble
Converts a string to a Double value.- Parameters:
value
- the string to convert- Returns:
- the corresponding Double value
-
MonthValueToString
Converts a month value to a string with two digits.- Parameters:
value
- the month value to convert- Returns:
- the formatted string
-
roundToTwoDecimalPlaces
public static double roundToTwoDecimalPlaces(double value) Rounds a double value to two decimal places.- Parameters:
value
- the value to round- Returns:
- the rounded value
-