package com.nmakademija.nmaakademija.entity;

import java.util.Date;

public class TimeUntilSession {

    private long sessionStart;
    private long sessionEnd;

    public TimeUntilSession(long StartTime, long EndTime) {
        sessionStart = StartTime * 1000;
        sessionEnd = EndTime * 1000;
    }

    public String returnTime() {
        long now = new Date().getTime();

        long timeLeft = Math.max(sessionStart - now, sessionEnd - now);
        long temp = timeLeft/(24*60*60*1000);
        String stringTimeLeft = (temp < 10 ? "0" : "")+Long.toString(temp)+ "d ";
        timeLeft = timeLeft % (24*60*60*1000);
        temp = timeLeft/(60*60*1000);
        stringTimeLeft = stringTimeLeft + (temp < 10 ? "0" : "")+Long.toString(temp)+":";
        timeLeft = timeLeft % (60*60*1000);
        temp = timeLeft/(60*1000);
        stringTimeLeft = stringTimeLeft + (temp < 10 ? "0" : "")+Long.toString(temp)+":";
        timeLeft = timeLeft % (60*1000);
        temp = timeLeft/(1000);
        stringTimeLeft = stringTimeLeft + (temp < 10 ? "0" : "")+Long.toString(temp);

        return stringTimeLeft;
    }

    public boolean isSession(){
        long now = new Date().getTime();
        return (sessionStart - now) < 0;
    }
}
@@ -41,16 +41,95 @@
 ity;%0D%0A%0D%0A
+import android.annotation.SuppressLint;%0D%0A%0D%0Aimport java.text.SimpleDateFormat;%0D%0A
 import j
@@ -144,16 +144,16 @@
 .Date;%0D%0A
-
 %0D%0Apublic
@@ -241,24 +241,107 @@
 sionEnd;%0D%0A%0D%0A
+    private SimpleDateFormat dateFormat;%0D%0A%0D%0A    @SuppressLint(%22SimpleDateFormat%22)%0D%0A
     public T
@@ -465,24 +465,80 @@
 me * 1000;%0D%0A
+        dateFormat = new SimpleDateFormat(%22HH:mm:ss%22);%0D%0A
     %7D%0D%0A%0D%0A   
@@ -689,55 +689,8 @@
 );%0D%0A
-        long temp = timeLeft/(24*60*60*1000);%0D%0A
     
@@ -710,613 +710,136 @@
 ring
-Time
+Days
 Left = 
-(temp %3C 10 ? %220%22 : %22%22)+Long.toString(temp)+ %22d %22;%0D%0A        timeLeft = timeLeft %25 (24*60*60*1000);%0D%0A        temp = timeLeft/(60*60*1000);%0D%0A        stringTimeLeft = stringTimeLeft + (temp %3C 10 ? %220%22 : %22%22)+Long.toString(temp)+%22:%22;%0D%0A        timeLeft = timeLeft %25 (60*60*1000);%0D%0A        temp = timeLeft/(60*1000);%0D%0A        stringTimeLeft =
+Long.toString(timeLeft/(24*60*60*1000))+ %22d %22;%0D%0A        return
  string
-Time
+Days
 Left + 
-(temp %3C 10 ? %220%22 : %22%22)+Long.toString(temp)+%22:%22;%0D%0A        timeLeft = timeLeft %25 (60*1000);%0D%0A        temp = timeLeft/(1000);%0D%0A        stringTimeLeft = stringTimeLeft + (temp %3C 10 ? %220%22 : %22%22)+Long.toString(temp);%0D%0A%0D%0A        return stringTimeLeft
+dateFormat.format(new Date(timeLeft))
 ;%0D%0A 

Simplify data formation