Остановился на защитной одежде (нужно добавить в таблицы это поле)

This commit is contained in:
2024-07-15 07:29:23 +05:00
parent dd2e9c4afe
commit 976d277a78
25 changed files with 1208 additions and 613 deletions

View File

@ -6,6 +6,10 @@ import android.os.Parcelable;
import android.util.AttributeSet;
import android.widget.EditText;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -32,13 +36,26 @@ public class DateTimeTM extends com.google.android.material.textfield.TextInputE
m_Value = val;
if(val!=null && !val.equals(""))
{
Date date = new Date(Long.parseLong(m_Value)*1000);
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm");
//format.setTimeZone(TimeZone.getTimeZone("UTC"));
String str = format.format(date);
setText(str);
Date date=null;
try {
date = new Date(Long.parseLong(m_Value)*1000);
} catch (NumberFormatException e) {
}
if(date==null){
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
date = format.parse(m_Value);
} catch (ParseException e) {
}
}
if(date!=null) {
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm");
//format.setTimeZone(TimeZone.getTimeZone("UTC"));
String str = format.format(date);
setText(str);
}else{
setText("");
}
}else
{
setText("");