Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8041843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:21:42+00:00 2026-06-05T04:21:42+00:00

I am a beginner in VB.NET & I am stuck at a very simple

  • 0

I am a beginner in VB.NET & I am stuck at a very simple thing, Date formats.

I am working on an application which uploads data from excel sheets into sql server database. The application will accept dates only if they are in mm/dd/yyyy format. It should reject all dates otherwise.

Now i am struggling to check its format. Here is my code.

Dim ROHSDate As String
ROHSDate = Trim(filterString(holdingTank))
... 
here i need to check if it is in mm/dd/yyyy format

Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:21:44+00:00Added an answer on June 5, 2026 at 4:21 am

    Use DateTime.TryParseExact, which allows you to specify the format – it will attempt to parse it, putting the parsed value into an output parameter on success, and return success/failure:

    Dim dt As DateTime
    If (DateTime.TryParseExact(ROHSDate, "mm/dd/yyyy", \
                               CultureInfo.InvariantCulture, \
                               DateTimeStyles.None, \
                               Out dt))
        UseDateTime(dt)
    End If
    

    Obviously, add Else clauses etc if you need them.

    (I believe in modern VB the line continuations may be unnecessary, but hey… hopefully you get the point.)

    Note that I’ve explicitly used CultureInfo.InvariantCulture so that if the code is running on a machine which uses different date separators or a different calendar, it won’t make any difference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple question from .NET beginner. How to work with colors in console application? VS
Which orm you would recommend for a beginner moving from ado.net?... Thus far used
As i am a beginner to asp.net-mvc which should i use ORM/ADO.NET data services....
I am just a beginner in ASP.NET. My question is simple, I wanna add
Probably a very basic beginner question. Imagine the following situation: I have an ASP.NET
Question from beginner. Why code <%= System.DateTime.Now.ToLongDateString() %> is not executed in ASP.NET. Could
I'm working in ASP.NET ( beginner ) and I tried to make update query
I am working in ASP.NET Web Application. I dont know about MVC and ASP.NET
I am a beginner in asp.net MVC. Importing table data using JSON, on column
I am a beginner with .NET environment. I have a windows application with three

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.