How to convert India Standard Time to SQL DataTime in C#

Last Reply on Dec 07, 2016 05:41 AM By revathip

Posted on Dec 07, 2016 04:41 AM

I created startdate column with datetime datatype in sql.

I'm storing this startdate value to array of string.for example

 string[] Param = parameters;

how to convert this startdate from string to datetime.

can anyone help me

Posted on Dec 07, 2016 05:14 AM

Hi revathip,

Refer the below code.

string[] Param = { DateTime.Now.ToString(), "2016/12/07", "2016/12/06", "2016/12/05", "2016/12/04", "Wed Dec 07 2016 00:00:00 GMT+0530 (India Standard Time)"};
DateTime date = DateTimeOffset.ParseExact(Param[5], "ddd MMM dd yyyy HH:mm:ss 'GMT'zzz '(India Standard Time)'", System.Globalization.CultureInfo.InvariantCulture).Date;