initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package ch.pizzalink.android.helper;
|
||||
|
||||
public class TextHelper {
|
||||
|
||||
public static String parseDate(String pureDate, boolean shouldShowTime){
|
||||
|
||||
if(pureDate == null || pureDate.trim().isEmpty())
|
||||
return "";
|
||||
// 2017-03-07 11:00:00.000000 9:0:0
|
||||
|
||||
String[] pureDateArray = pureDate.split(" ");
|
||||
String date = pureDateArray[0];
|
||||
|
||||
String[] dateArray = date.split("-");
|
||||
String year = dateArray[0];
|
||||
String month = dateArray[1];
|
||||
String day = dateArray[2];
|
||||
|
||||
if(!shouldShowTime)
|
||||
return day + "." + month + "." + year;
|
||||
|
||||
String time = pureDateArray[1];
|
||||
time = time.substring(0, 5);
|
||||
|
||||
return day + "." + month + "." + year + " " + "Saat " + time;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user