From 06726906de121e03d07c597788a1845d4db7645b Mon Sep 17 00:00:00 2001
From: greeshma <greeshma.kk@vtiger.com>
Date: Sat, 12 Jun 2021 16:02:47 +0530
Subject: [PATCH] date format save changes in detailview is supported

---
 include/utils/utils.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/utils/utils.php b/include/utils/utils.php
index a5a4e1b4a..7f5f69364 100755
--- a/include/utils/utils.php
+++ b/include/utils/utils.php
@@ -1803,7 +1803,12 @@ function getValidDBInsertDateValue($value) {
 			break;
 		}
 	}
-	list($y,$m,$d) = explode('-',$value);
+	global $current_user;
+	$formate=$current_user->date_format;
+	list($d,$m,$y) = explode('-',$value);
+	if(strlen($d) == 4 || $formate == 'mm-dd-yyyy'){
+		list($y,$m,$d)=explode('-',$value);
+	}
 	if(strlen($y) == 1) $y = '0'.$y;
 	if(strlen($m) == 1) $m = '0'.$m;
 	if(strlen($d) == 1) $d = '0'.$d;
-- 
GitLab