| Line 12... |
Line 12... |
| 12 |
private static Locale indianLocale = new Locale("en", "IN");
|
12 |
private static Locale indianLocale = new Locale("en", "IN");
|
| 13 |
private static DecimalFormat f = new DecimalFormat("##.00");
|
13 |
private static DecimalFormat f = new DecimalFormat("##.00");
|
| 14 |
private NumberFormat currencyFormat;
|
14 |
private NumberFormat currencyFormat;
|
| 15 |
private static DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
|
15 |
private static DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
|
| 16 |
private static DateTimeFormatter reporticoFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
16 |
private static DateTimeFormatter reporticoFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
| - |
|
17 |
private static DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
|
| 17 |
|
18 |
|
| 18 |
public FormattingUtils(){
|
19 |
public FormattingUtils(){
|
| 19 |
currencyFormat = NumberFormat.getNumberInstance(indianLocale);
|
20 |
currencyFormat = NumberFormat.getNumberInstance(indianLocale);
|
| 20 |
currencyFormat.setMaximumFractionDigits(2);
|
21 |
currencyFormat.setMaximumFractionDigits(2);
|
| 21 |
currencyFormat.setMinimumFractionDigits(2);
|
22 |
currencyFormat.setMinimumFractionDigits(2);
|
| Line 30... |
Line 31... |
| 30 |
|
31 |
|
| 31 |
public String formatPrice(double amount){
|
32 |
public String formatPrice(double amount){
|
| 32 |
return currencyFormat.format(amount);
|
33 |
return currencyFormat.format(amount);
|
| 33 |
}
|
34 |
}
|
| 34 |
|
35 |
|
| - |
|
36 |
public static String format(LocalDateTime localDateTime){
|
| - |
|
37 |
return localDateTime.format(dateTimeFormatter);
|
| - |
|
38 |
}
|
| - |
|
39 |
|
| 35 |
public static String formatDecimalTwoDigits(double number) {
|
40 |
public static String formatDecimalTwoDigits(double number) {
|
| 36 |
return f.format(number);
|
41 |
return f.format(number);
|
| 37 |
}
|
42 |
}
|
| 38 |
public static String formatDate(LocalDateTime dateTime) {
|
43 |
public static String formatDate(LocalDateTime dateTime) {
|
| 39 |
return dateTime.format(dateFormatter);
|
44 |
return dateTime.format(dateFormatter);
|