ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.How to convert India Standard Time to SQL DataTime in C#<p>Hi <a class="username" rel="revathip"> revathip</a>,</p> <p>&nbsp;Refer the below code sample.</p> <pre class="brush: csharp">string[] Param = { DateTime.Now.ToString(), &#34;2016/12/07&#34; }; DateTime date1 = Convert.ToDateTime(Param[0]); // 12/7/2016 5:04:41 PM DateTime date2 = Convert.ToDateTime(Param[1]); // 12/7/2016 12:00:00 AM</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/827694/How-to-convert-India-Standard-Time-to-SQL-DataTime-in-C/https://www.aspforums.net:443/Threads/827694/How-to-convert-India-Standard-Time-to-SQL-DataTime-in-C/Wed, 07 Dec 2016 04:43:28 GMTHow to convert India Standard Time to SQL DataTime in C#<p>when i convert like this,</p> <p>&nbsp; &nbsp; &nbsp; &nbsp;DateTime startdate = Convert.ToDateTime(Param[5]);</p> <p>it shows the following error,</p> <p>string was not recognized as a valid DateTime</p>https://www.aspforums.net:443/Threads/827694/How-to-convert-India-Standard-Time-to-SQL-DataTime-in-C/https://www.aspforums.net:443/Threads/827694/How-to-convert-India-Standard-Time-to-SQL-DataTime-in-C/Wed, 07 Dec 2016 04:56:10 GMTHow to convert India Standard Time to SQL DataTime in C#<blockquote><cite>revathip says:</cite> <pre>Param[5]</pre> </blockquote> <p>&nbsp;provide the data in param[5]</p>https://www.aspforums.net:443/Threads/827694/How-to-convert-India-Standard-Time-to-SQL-DataTime-in-C/https://www.aspforums.net:443/Threads/827694/How-to-convert-India-Standard-Time-to-SQL-DataTime-in-C/Wed, 07 Dec 2016 04:58:52 GMTHow to convert India Standard Time to SQL DataTime in C#<p>"Wed Dec 07 2016 00:00:00 GMT+0530 (India Standard Time)"</p>https://www.aspforums.net:443/Threads/827694/How-to-convert-India-Standard-Time-to-SQL-DataTime-in-C/https://www.aspforums.net:443/Threads/827694/How-to-convert-India-Standard-Time-to-SQL-DataTime-in-C/Wed, 07 Dec 2016 05:03:15 GMTHow to convert India Standard Time to SQL DataTime in C#<p>Hi <a class="username" rel="revathip"> revathip</a>,</p> <p>Refer the below code.</p> <pre class="brush: csharp">string[] Param = { DateTime.Now.ToString(), &#34;2016/12/07&#34;, &#34;2016/12/06&#34;, &#34;2016/12/05&#34;, &#34;2016/12/04&#34;, &#34;Wed Dec 07 2016 00:00:00 GMT+0530 (India Standard Time)&#34;}; DateTime date = DateTimeOffset.ParseExact(Param[5], &#34;ddd MMM dd yyyy HH:mm:ss &#39;GMT&#39;zzz &#39;(India Standard Time)&#39;&#34;, System.Globalization.CultureInfo.InvariantCulture).Date;</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/827694/How-to-convert-India-Standard-Time-to-SQL-DataTime-in-C/https://www.aspforums.net:443/Threads/827694/How-to-convert-India-Standard-Time-to-SQL-DataTime-in-C/Wed, 07 Dec 2016 05:14:04 GMTHow to convert India Standard Time to SQL DataTime in C#<p>Thank u so much.</p>https://www.aspforums.net:443/Threads/827694/How-to-convert-India-Standard-Time-to-SQL-DataTime-in-C/https://www.aspforums.net:443/Threads/827694/How-to-convert-India-Standard-Time-to-SQL-DataTime-in-C/Wed, 07 Dec 2016 05:41:24 GMT