C# Date format

lankapala
lankapala used Ask the Experts™
on
Hi, Following code is working in the VS2015 but not working in the 2012

DateTime startDate
startDate.ToUniversalTime():s

Open in new window

This one is working in the 2012 startDate.ToUniversalTime() But after enter startDate.ToUniversalTime():s, getting error.
Any idea appricate.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010
Commented:
What is the error?  And what is the value of startDate ?  and what is ' :s ' ?

The problem is not going to be your version of Visual Studio, but the value of startDate, or what ' :s' is doing.

You'll see that this works fine:
		var startDate = DateTime.Now;
		var test = startDate.ToUniversalTime();
		Console.WriteLine(test);

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial