Unity2D: How to resume timer even after application has quit

Basically I have a countdown timer with in my game. What I basically want to do is continue my timer playing even if I close out of my application and play it again, I want the timer to continue counting down. Kind of like clash of clan when the counter is still work when the app is closed. For example: if I exit the game and the timer is on 1:30 (1 minute, 30 seconds). Then if I restart the game 30 seconds later, the timer should show 1:00 (1 minute, 0 seconds) Or if I close the game 30 seconds later, the timer should show 1:00 (1 minute, 0 seconds)

So far this is as far as I’ve got:

public Text timer;
float minutes = 1;
float seconds = 0;
float miliseconds = 0;
public int curHealth;
public int maxHealth = 3;

void Start ()
{
	curHealth = maxHealth;
}

void Awake ()
{

	if (PlayerPrefs.HasKey("TimeOnExit"))
	{ 
		var x = DateTime.Now - DateTime.Parse(PlayerPrefs.GetString("TimeOnExit"));
		PlayerPrefs.DeleteKey("TimeOnExit");
	}

}
void Update(){
	if(miliseconds <= 0){
		if(seconds <= 0){
			minutes--;
			seconds = 59;
		}
		else if(seconds >= 0){
			seconds--;
		}
		
		miliseconds = 100;
	}
	
	miliseconds -= Time.deltaTime * 100;
	
	//Debug.Log(string.Format("{0}:{1}:{2}", minutes, seconds, (int)miliseconds));
	timer.text = string.Format("{0}:{1}", minutes, seconds, (int)miliseconds);
}
private void OnApplicationQuit()
{
	PlayerPrefs.SetString("TimeOnExit", DateTime.Now.ToShortTimeString());
}

}

But it doesn’t really work as nothing really happens when I close the game and re-open it again as the timer just restarts.

Try out this updated version of your script (tested)

public Text timer;
int minutes = 1;
int seconds = 0;
float miliseconds = 0;
public int curHealth;
public int maxHealth = 3;

private int savedSeconds;

void Start ()
{
    curHealth = maxHealth;
}

void Awake ()
{
    if (PlayerPrefs.HasKey("TimeOnExit"))
    { 
        miliseconds = PlayerPrefs.GetFloat("TimeOnExit");

        minutes = (int)miliseconds / 60;
        miliseconds -= (minutes * 60);

        seconds = (int)miliseconds;
        miliseconds -= seconds;

        PlayerPrefs.DeleteKey("TimeOnExit");
    }

}

public void Update()
{
    // count down in seconds
    miliseconds += Time.deltaTime;
    if(miliseconds >= 1.0f)
    {
        miliseconds -= 1.0f;
        seconds--;
        if(seconds < 0)
        {
            seconds = 59;
            minutes--;
        }
    }
    
    if (seconds != savedSeconds)
    {
        //  Show current time
        timer.text = string.Format("Time : {0}:{1:D2}", minutes, seconds);
        savedSeconds = seconds;
    }
}

private void OnApplicationQuit()
{
    miliseconds += ((minutes * 60) + seconds);
    PlayerPrefs.SetFloat("TimeOnExit", miliseconds);
}