0
How to return two different time formats?
I'm trying to create a method to return US time format and a Uk time format in one method. public class DateFormatter { public String formatDate(Date date) { if(date == null) { throw new IllegalArgumentException(); } String formatDate = date.getMonth() + "/" + date.getDay() + "/" + date.getYear(); return formatDate; } }
1 ответ
+ 1
In Java there is a thing known as ZoneDateTime you can use that.