| | |
| | | |
| | | import android.annotation.SuppressLint; |
| | | |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.sdk.link.core.utils.LanguageUtils; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | |
| | | */ |
| | | public static String getDateTimestamp(long timestamp) { |
| | | try { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd ", Locale.ENGLISH); |
| | | Date date = new Date(timestamp); |
| | | return dateFormat.format(date); |
| | | } catch (Exception e) { |
| | |
| | | */ |
| | | public static String getTimeFromTimestamp(long timestamp) { |
| | | try { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH); |
| | | String pattern = "yyyy-MM-dd HH:mm"; |
| | | if (UserConfigManage.getInstance().getCurrentAppLanguage().equals(LocalManageUtil.en)) { |
| | | pattern = "dd-MM-yyyy HH:mm"; |
| | | } |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, Locale.ENGLISH); |
| | | Date date = new Date(timestamp); |
| | | return dateFormat.format(date); |
| | | } catch (Exception e) { |