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 8429269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:17:19+00:00 2026-06-10T05:17:19+00:00

I have product list and every product has create date in DateTime type. I

  • 0

I have product list and every product has create date in DateTime type. I want to take some products that created after my entering time in string type.

I enter EnteredDate in string type, like this format : 05/16/2012

1.    var dates = from d in Products
2.                where d.CreateDate >= DateTime.ParseExact( EnteredDate, "mm/dd/yy", null )
3.                select d;

In second line I got error as String was not recognized as a valid DateTime for “mm/dd/yy”.
I also tried DateTime.Parse(), Convert.ToDateTime() and got same error.
How can I filter this product list by create date?

  • 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-10T05:17:21+00:00Added an answer on June 10, 2026 at 5:17 am

    “mm” is minutes, and your year is 4 digits, not 2. You want “MM/dd/yyyy”, if your format is really always that. How confident are you on that front? (In particular, if it’s entered by a user, you should probably make your code culture-sensitive…)

    I would suggest pulling the parsing part out of the query though, and also probably using the invariant culture for parsing if you’ve really got a fixed format:

    DateTime date = DateTime.ParseExact(EnteredDate, "MM/dd/yyyy",
                                        CultureInfo.InvariantCulture);
    
    var dates = Products.Where(d => d.CreateDate >= date);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Products:List<Product> class. I'd like to make it so that every time
I have a website that has products list page and product detail page .
Suppose I have a list of three products (A, B C). Each Product has
I have an object OrderDetail. This has an ID, List of product objects and
I have a order list and I want to generate and rank the product
I have a mysql table (table-A) that contains a list of unique product ids.
The structure is A product has a list of categories. categories have a list
I have a product admin web site that has been generated using ASP.NET Dynamic
i need a list from all products that contains 2 columns with the date
I have a list of product edition serial numbers to store in MongoDB, eg,

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.