Date And Time Format issue in asp.net C#

How to initialize following format to date time variable?
yyyy-mm-dd'T'hh:mm:ssz
i.e. 2013-09-29T10:21:25.078Z
My Result must be as follows :
DateTime dateTime = new DateTime();
dateTime =  2013-09-29T10:21:25.078Z
Please help me on this.
iiplAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Carl TawnSystems and Integration DeveloperCommented:
You should be able to use the DateTime types Parse() method:
DateTime dt = DateTime.Parse("2013-09-29T10:21:25.078Z");

Open in new window

0
Ken ButtersCommented:
Try this:

DateTime dateTime = DateTime.Parse("2013-09-29T10:21:25.078Z");
0
Ken ButtersCommented:
whoops... carl_tawn beat me to it.
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

iiplAuthor Commented:
Hello.
Thanks for your valuable suggestion.
I have tried your solution but it should be return 29/09/2013 15:51:25.
But i need following format in C# and assign to DateTime variable.

2013-09-29T10:21:25.078Z
0
XGISCommented:
Have a go with this.

DateTime dt= new DateTime();
String.Format("{0:MM/dd/yyyy}", dt)

Happy coding.
0
iiplAuthor Commented:
Hi
Thanks to all for participation.

Actually the problem was due to DateTimeKind property. Once set to appropriate for UTF, the vendor API had accepted the value automatically.

Thanks
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
iiplAuthor Commented:
The question was posted in a bit hurry so could not include entire scenario or the problem. Now the problem was due to DateTimeKind property of DateTime object and was lately resolved by using appropriate value.
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.