Yahoo Poland Wyszukiwanie w Internecie

Search results

  1. 28 maj 2009 · Let's say you have a date with format yyMMdd. The fastest way to convert it that I found is: var d = new DateTime((s[0] - '0') * 10 + s[1] - '0' + 2000, (s[2] - '0') * 10 + s[3] - '0', (s[4] - '0') * 10 + s[5] - '0') Just, choose the indexes according to your date format of choice.

  2. 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.

  3. 21 mar 2011 · string s = "2011-03-21 13:26"; DateTime dt = DateTime.ParseExact(s, "yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture); (But note that it is usually safer to use one of the TryParse() methods in case a date is not in the expected format)

  4. Learn how to use the Convert.ToDateTime method to convert a string representation of a date and time to an equivalent DateTime value in C#. See the definition, parameters, exceptions, examples, and remarks of this method.

  5. 11 gru 2017 · Use DateTime.ParseExact() method. Converts the specified string representation of a date and time to its DateTime equivalent using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly.

  6. Restore (round-trip) a date and time value created by a formatting operation. Pass the "o" or "r" standard format string to the ToString (String) method, and call the Parse (String, IFormatProvider, DateTimeStyles) overload with DateTimeStyles.RoundtripKind.

  7. 11 mar 2024 · Learn how to convert strings to DateTime or vice versa in C# using built-in methods and sample codes. Understand the basics of string and DateTime data types, the importance of date and time manipulation, and common errors to avoid.

  1. Ludzie szukają również