{"id":48,"date":"2009-07-20T07:40:16","date_gmt":"2009-07-20T07:40:16","guid":{"rendered":"http:\/\/mahenderpal.wordpress.com\/?p=48"},"modified":"2009-07-20T07:40:16","modified_gmt":"2009-07-20T07:40:16","slug":"get-date-part-from-sqldate","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=48","title":{"rendered":"Get Date Part from Sqldate"},"content":{"rendered":"<p>Most of the time we need to set datatime field value in crm, but problem is that ms crm datetime file format is different from sql server date format so i have written a some js to get date part from sqlserver datetime field.<br \/>\nwe can pass datetime value to this function and it will return date part from datetime value.<br \/>\nfunction GetDate(strCrmFormatDate)<br \/>\n{<br \/>\nvar newDate=new Date();<br \/>\nvar indexofT=strCrmFormatDate.indexOf(&#8220;T&#8221;);<br \/>\nvar strdatepart=strCrmFormatDate.substring(0,indexofT);<br \/>\nvar month=strdatepart.substring(5,7);<br \/>\nvar year=strdatepart.substring(0,4);<br \/>\nvar day=strdatepart.substring(8);<br \/>\nif(month.substring(0,1)==&#8217;0&#8242;)<br \/>\n{<br \/>\nmonth=month.substring(1);<br \/>\n}<\/p>\n<p>newDate.setMonth(parseInt(month)-1);<br \/>\nnewDate.setFullYear(year);<br \/>\nnewDate.setDate(day);<br \/>\nreturn newDate;<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most of the time we need to set datatime field value in crm, but problem is that ms crm datetime file format is different from sql server date format so i have written a some js to get date part from sqlserver datetime field. we can pass datetime value to this function and it will return date part from datetime&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=48\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[25],"tags":[],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/48"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=48"}],"version-history":[{"count":0,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/48\/revisions"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}