Im works with VS2008, .NET and C #, and I need to send the DATETIME variable to one of our clients.
The problem is that they want to have a date in Sort date / time ("s") format.
When I get the actual datetime, this is a Datetime object. When I format it to this format, now it is a String object and it has the format that I want. But after that, I cannot create a Datetime object from a formatted string in the same format, because it always returns it to the original Datetime format.
More specific:
DateTime currTime = System.DateTime.Now;
String date = String.Format("{0:s}", currTime);
DateTime newDate = DateTime.Parse(date);
IFormatProvider culture = new System.Globalization.CultureInfo("", true);
String format = "s";
DateTime fecha = DateTime.ParseExact(date, format, culture);
Is there a way to get a Datetime object with the desired format, or do Datetime objects use this format, and you cannot format them in equivalent string formats?
thank