Converts string to DateTime using specified format and culture-specific format information : Date Time « Date Time « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net » Date Time » Date TimeScreenshots 
Converts string to DateTime using specified format and culture-specific format information
 
Imports System.Globalization

Module MainClass
   Public Sub Main()
        
        Dim dateString, format As String  
        Dim result As Date
        Dim provider As CultureInfo = CultureInfo.InvariantCulture
        
        dateString = "06/15/2010"
        format = "d"
        Try
           result = Date.ParseExact(dateString, format, provider)
           Console.WriteLine("{0} converts to {1}.", dateString, result.ToString())
        Catch As FormatException
           Console.WriteLine("{0} is not in the correct format.", dateString)
        End Try 
   End Sub
End Module

   
  
Related examples in the same category
1.Date time: Now, Today and UTC NowDate time: Now, Today and UTC Now
2.Date Time Detail: Long Date String, day of week, days in monthDate Time Detail: Long Date String, day of week, days in month
3.Is Leap YearIs Leap Year
4.Get Date Time NowGet Date Time Now
5.Display the various properties for a DateDisplay the various properties for a Date
6.Finding the Last Day of the Month
7.Assign a value according to the current day of the week.
8.DateTime.ParseExact passes a string object followed by a format specifier and a CultureInfo object
9.DateTimeOffset represents time relative to Coordinated Universal Time (UTC).
10.Find difference between Now and UtcNow using DateTimeOffset
11.Add two and a half hours to DateTimeOffset
12.Convert DateTimeOffset to Universal Time
13.DateTime - DateTime = TimeSpan
14.DateTime.ParseExact Converts string to DateTime using specified format, culture-specific format information, and style
15.DateTime.Subtract subtracts the specified date and time from this instance.
16.DateTime.Ticks represents the number of ticks that represent the date and time
17.DateTime.Today Property Gets the current date.
18.DateTime.ToFileTime Method converts DateTime to a Windows file time.
19.DateTime.ToLocalTime Method converts DateTime object to local time.
20.DateTime Kind, Now properties, and the SpecifyKind(), ToLocalTime(), and ToUniversalTime() methods.
21.DateTime.ToLongDateString converts DateTime to long date string
22.Converts the value of the current DateTime object to its equivalent short date string representation.
23.DateTime.ToString Method converts DateTime to string using the specified culture-specific format information.
24.DateTime.ToString converts DateTime to string using the specified format.
25.Converts DateTime to string using the specified format and culture-specific format information.
26.Combine date format with DateTimeFormatInfo.InvariantInfo
27.Converts DateTime to string representation.
28.Converts DateTime object to Coordinated Universal Time (UTC).
29.Converts string to DateTime equivalent and returns a value that indicates whether the conversion succeeded.
30.Converts string to DateTime using specified culture-specific format information and formatting style
31.Converts string to DateTime using specified format, culture-specific format information, and style
32.DateTime.Year Property gets the year component of the date represented by this instance.
33.DateTimeFormatInfo defines how DateTime values are formatted and displayed, depending on the culture.
34.DateTime format: D
35.DateTime format: f
36.DateTime format: F
37.DateTime format: g
38.DateTime format: G
39.DateTime format: m
40.DateTime format: M
41.DateTime format: o
42.DateTime format: r
43.DateTime format: R
44.DateTime format: s
45.DateTime format: t
46.DateTime format: T
47.DateTime format: u
48.DateTime format: U
49.DateTime format: y
50.DateTime format: Y
51.Difference Between DateTime, DateTimeOffset, and TimeZoneInfo
52.Create DateTime structure to the specified year, month, and day.
53.Create DateTime structure to the specified year, month, and day for the specified calendar.
54.Create DateTime structure to the specified year, month, day, hour, minute, and second.
55.Create DateTime structure to the specified year, month, day, hour, minute, and second for the specified calendar.
56.Create DateTime structure to the specified year, month, day, hour, minute, second, and Coordinated Universal Time (UTC) or local time.
57.Create DateTime structure to the specified year, month, day, hour, minute, second, and millisecond.
58.Create DateTime structure to the specified year, month, day, hour, minute, second, and millisecond for the specified calendar.
59.Create DateTime structure to the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal Time (UTC) or local time for the specified calendar.
60.Create DateTime structure to the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal Time (UTC) or local time.
61.Create DateTime structure to a specified number of ticks.
62.DateTime Min value
63.DateTime ToString with Invariant Culture
64.Add specified TimeSpan to DateTime
65.Add days to DateTime
66.Add hours to DateTime
67.Add milliseconds to DateTime
68.Compares DateTime value
69.Get date and time fields from DateTime
70.Determines whether two specified instances of DateTime are equal.
71.Returns a value indicating whether this instance is equal to the specified DateTime instance.
72.DateTime.Equals(DateTime, DateTime) Returns a value indicating whether two instances of DateTime are equal.
73.DateTime.FromBinary Deserializes a 64-bit binary value and recreates an original serialized DateTime object.
74.DateTime.FromFileTime Converts the specified Windows file time to an equivalent local time.
75.DateTime.GetDateTimeFormats
76.The largest possible value of DateTime. This field is read-only.
77.DateTime Minute Property
78.The smallest possible value of DateTime.
79.DateTime.Parse converts string to DateTime
80.Converts string to DateTime using the specified culture-specific format information.
81.Converts string to DateTime using the specified culture-specific format information and formatting style.
82.CultureInfo.DateTimeFormat
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.