Converts string to DateTimeOffset: String with time only(11:36 PM) : DateTimeOffset Parse « Date Time « C# / C Sharp






Converts string to DateTimeOffset: String with time only(11:36 PM)

Converts string to DateTimeOffset: String with time only(11:36 PM)
 

using System;
using System.Globalization;
public class Test
{
   public static void Main()
   {  

        string dateString;
        DateTimeOffset offsetDate; 
        
        dateString = "11:36 PM";
        offsetDate = DateTimeOffset.Parse(dateString);
        Console.WriteLine(offsetDate.ToString());
   }
}

   
  








Related examples in the same category

1.Converts string to DateTimeOffset: String with date only(05/01/2008)Converts string to DateTimeOffset: String with date only(05/01/2008)
2.Converts string to DateTimeOffset: String with date and offset (05/01/2008 +1:00)Converts string to DateTimeOffset: String with date and offset (05/01/2008 +1:00)
3.Converts string to DateTimeOffset: String with day abbreviation(Thu May 01, 2008)Converts string to DateTimeOffset: String with day abbreviation(Thu May 01, 2008)
4.Converts string to DateTimeOffset using the specified culture-specific format information.Converts string to DateTimeOffset using the specified culture-specific format information.
5.Converts string to DateTimeOffset:"15/09/07 08:45:00 +1:00"Converts string to DateTimeOffset:
6.Converts string to DateTimeOffset:"mar. 1 janvier 2008 1:00:00 +1:00"Converts string to DateTimeOffset:
7.Converts string to DateTimeOffset using the specified culture-specific format information and formatting style.Converts string to DateTimeOffset using the specified culture-specific format information and formatting style.
8.Parse date-only value with invariant culture.Parse date-only value with invariant culture.
9.Parse date-only value without leading zero in month using "d" format.Parse date-only value without leading zero in month using
10.Parse date and time with custom specifier.Parse date and time with custom specifier.
11.Parse date and time with offset without offset//s minutes.Parse date and time with offset without offset//s minutes.
12.Parse date-only value with invariant culture and assume time is UTC.Parse date-only value with invariant culture and assume time is UTC.
13.Parse date-only value with leading white space.Parse date-only value with leading white space.
14.Parse date and time value, and allow all white space.Parse date and time value, and allow all white space.
15.Parse date and time and convert to UTC.Parse date and time and convert to UTC.
16.Tries to converts a string to DateTimeOffset(String with date only)
17.Tries to converts a string to DateTimeOffset(String with time only)
18.Tries to converts a string to DateTimeOffset(String with date and offset )
19.Tries to converts a string to DateTimeOffset(String with day abbreviation)
20.Tries to converts a string to DateTimeOffset(String with date, time with AM/PM designator, and offset)