Converts string to DateTimeOffset:"mar. 1 janvier 2008 1:00:00 +1:00" : DateTimeOffset Parse « Date Time « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Date Time
8.Design Patterns
9.Development Class
10.Event
11.File Stream
12.Generics
13.GUI Windows Form
14.Internationalization I18N
15.Language Basics
16.LINQ
17.Network
18.Office
19.Reflection
20.Regular Expressions
21.Security
22.Services Event
23.Thread
24.Web Services
25.Windows
26.Windows Presentation Foundation
27.XML
28.XML LINQ
C# / C Sharp » Date Time » DateTimeOffset ParseScreenshots 
Converts string to DateTimeOffset:"mar. 1 janvier 2008 1:00:00 +1:00"
Converts string to DateTimeOffset:
 

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

        DateTimeFormatInfo fmt = new CultureInfo("fr-fr").DateTimeFormat;
        string dateString;
        DateTimeOffset offsetDate;
        
        dateString = "mar. 1 janvier 2008 1:00:00 +1:00"
        offsetDate = DateTimeOffset.Parse(dateString, fmt);
        Console.WriteLine("{0} returns {1}", dateString, 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 time only(11:36 PM)Converts string to DateTimeOffset: String with time only(11:36 PM)
3.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)
4.Converts string to DateTimeOffset: String with day abbreviation(Thu May 01, 2008)Converts string to DateTimeOffset: String with day abbreviation(Thu May 01, 2008)
5.Converts string to DateTimeOffset using the specified culture-specific format information.Converts string to DateTimeOffset using the specified culture-specific format information.
6.Converts string to DateTimeOffset:"15/09/07 08:45: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)
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.