How can i stop timer

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class Timer : MonoBehaviour 
	{
		public Text timerText;
		private float startTime;

	// Use this for initialization
	void Start () {
			startTime = Time.time;
	}
	
	// Update is called once per frame
	void Update () {
			float t = Time.time - startTime;

			string minutes = ((int) t / 60).ToString();
			string seconds = (t % 60 ).ToString("f2");
			
			timerText.text = minutes + ":" + seconds;
	}
	}

it is the script i want to add if statement at viod update
if ( something == true)
{
stop timer
}
it is your finish time 13:21 for example thanks

Just setup a boolean, and only add to the timer variable or set the variable, if the bool is true.

public class Timer : MonoBehaviour {

public Text timerText;
private float startTime;

	bool keepTiming;
	float timer;

	void Start () {
		StartTimer();
	}

	void Update () {
		if(somethingHasHappened){
			Debug.Log("Timer stopped at " + TimeToString(StopTimer()));
		}

		if(keepTiming){
			UpdateTime();
		}
	}

	void UpdateTime(){
		timer = Time.time - startTime;
		timerText.text = TimeToString(timer);
	}

	float StopTimer(){
		keepTiming = false;
		return timer;
	}

	void ResumeTimer(){
		keepTiming = true;
		startTime = Time.time-timer;
	}

	void StartTimer(){
		keepTiming = true;
		startTime = Time.time;
	}

	string TimeToString(float t){
		string minutes = ((int) t / 60).ToString();
		string seconds = (t % 60 ).ToString("f2");
		return minutes + ":" + seconds;
	}
}