Advertisements
Home > ASP.NET > Convert string to DateTime in vb.net

Convert string to DateTime in vb.net


VB.NET

Dim strDate As String = “21/07/2006”

Dim dtfi As New DateTimeFormatInfo()
dtfi.ShortDatePattern = "dd/MM/yyyy"
dtfi.DateSeparator = "/"
Dim objDate As DateTime = Convert.ToDateTime(strDate, dtfi)

C#

string strDate = "21/07/2006";
DateTimeFormatInfo dtfi = new DateTimeFormatInfo();
dtfi.ShortDatePattern = "dd/MM/yyyy";
dtfi.DateSeparator = "/";
DateTime objDate = Convert.ToDateTime(strDate, dtfi);
 
Advertisements
Categories: ASP.NET
  1. September 21, 2014 at 2:40 am

    It’s a pity you don’t have a donate button! I’d certainly donate to this outstanding blog!
    I guess for now i’ll settle for book-marking and adding
    your RSS feed to my Google account. I look forward to neew updates and will talk about this blog with my Facebook group.
    Talk soon!

  2. bhavesh
    November 16, 2015 at 10:37 pm

    Thank you…

  3. November 16, 2015 at 10:37 pm

    Thank you.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: