diff --git a/modules/Vtiger/uitypes/Time.php b/modules/Vtiger/uitypes/Time.php
index 868152acfcb1ed28a3f69fd7bdb62af6fe7c2e22..36047e00eb2ea0ac682a2c3f4f84d29e2f0a6f51 100644
--- a/modules/Vtiger/uitypes/Time.php
+++ b/modules/Vtiger/uitypes/Time.php
@@ -59,13 +59,14 @@ class Vtiger_Time_UIType extends Vtiger_Base_UIType {
 
 	/**
 	 * Function to get Time value with seconds
-	 * @param <String> $time
+	 * @param <String> $time hh:mm[:ss] [AM|PM]
 	 * @return <String> time
 	 */
 	public static function getTimeValueWithSeconds($time) {
 		if($time){
-			if (substr_count($time, ':') < 2) $time .= ':'; // adding : if seconds value is missing to avoid undefined array key error
 			$timeDetails = explode(' ', $time);
+
+			if (substr_count($timeDetails[0], ':') < 2) $timeDetails[0] .= ':'; // adding : if seconds value is missing to avoid undefined array key error
 			list($hours, $minutes, $seconds) = explode(':', $timeDetails[0]);
 
 			//If pm exists and if it not 12 then we need to make it to 24 hour format