Yahoo Poland Wyszukiwanie w Internecie

Search results

  1. You can convert your string to a DateTime value like this: DateTime date = DateTime.Parse(something); You can convert a DateTime value to a formatted string like this: date.ToString("yyyyMMdd");

  2. 21 mar 2011 · DateTime.Parse() will try figure out the format of the given date, and it usually does a good job. If you can guarantee dates will always be in a given format then you can use ParseExact() : string s = "2011-03-21 13:26"; DateTime dt = DateTime.ParseExact(s, "yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture);

  3. 28 maj 2009 · DateTime.Parse() and DateTime.ParseExact(). The first is very forgiving in terms of syntax and will parse dates in many different formats. It is good for user input which may come in different formats. ParseExact will allow you to specify the exact format of your date string to use for parsing.

  4. 16 cze 2014 · Convert Object to a DateTime. Ask Question. Asked 13 years, 2 months ago. Modified 6 years, 2 months ago. Viewed 89k times. 25. public static DateTime ObjectToDateTime(object o, DateTime defaultValue) { . if (o == null) return defaultValue; DateTime dt; if (DateTime.TryParse(o.ToString(), out dt)) return dt; else. return defaultValue; }

  5. 13 maj 2021 · You can convert a string to a DateTime (parse) with one of these methods: DateTime.Parse() (or TryParse). Use this to parse a variety of standard formats (culture-specific or ISO-8601) DateTime.ParseExact() (or TryParseExact). Use this to parse from a specific format. I’ll show examples of using both methods for parsing various DateTime formats.

  6. 4 paź 2022 · The DateTime.ParseExact method converts a string to a DateTime object if it conforms to one of the specified string patterns. When a string that isn't one of the forms specified is passed to this method, a FormatException is thrown.

  7. Converts a memory span that contains string representation of a date and time to its DateTime equivalent by using culture-specific format information and a formatting style. Parse(String, IFormatProvider, DateTimeStyles)

  1. Ludzie szukają również