Package snap.util
Class FormatUtils
java.lang.Object
snap.util.FormatUtils
Utilities for formatting numbers and dates.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatDate
(Date aDate) Formats a Date to a standard pattern: .static String
formatDate
(Date aDate, String aPattern) Formats a Date to a reasonable precision.static String
formatNum
(double aValue) Formats a number to a reasonable precision.static String
Formats a number to a reasonable precision.static String
Formats a number with given Decimal format pattern.static SimpleDateFormat
Returns a SimpleDateFormat.static DateFormat
getDateFormat
(String aPattern) Returns a date format for given pattern.static DecimalFormat
getDecimalFormat
(String aPattern) Returns a decimal format for given pattern.static String
getPatternForFractionDigits
(int aFractionDigitCount) Returns a pattern for given number of fraction digits.
-
Constructor Details
-
FormatUtils
public FormatUtils()
-
-
Method Details
-
formatNum
Formats a number to a reasonable precision. -
formatNum
Formats a number to a reasonable precision. -
formatNum
Formats a number with given Decimal format pattern. -
getDecimalFormat
Returns a decimal format for given pattern. -
getDateFormat
Returns a date format for given pattern. -
formatDate
Formats a Date to a standard pattern: . -
formatDate
Formats a Date to a reasonable precision. -
getDateFormat
Returns a SimpleDateFormat. -
getPatternForFractionDigits
Returns a pattern for given number of fraction digits.
-