isDate in VB.NET

Wow, I asked if this was a date, not “Please format this as a date and check it for me….” So on this project we’ve been having some fun with the testers on the user side, and one of which sent us an issue saying “I entered 7/////////7 for a date and it accepted that as valid.” Well clearly that’s not right, we won’t go into why you’d enter that but ok…

A little searching for the save routine….

Hrmm, we’re calling isDate, why would it let that slip. Let’s see what’s going into the database. 7/7/2005

Ugh… Can I get an isDate function, and if you want a FormatAndValidateDate function as well, though not quite necessary.

f16b4bcc357e8048d89a19162ce45111->

0bc7fbc71d36ae5d815bedd024944f9d->

6d2b4423ea51a4524246a8964f58334d->


3 Responses to “isDate in VB.NET”  

  1. 1 namelessmike

    .net 2.0?
      If so, DateTime.TryParse http://msdn2.microsoft.com/en-us/library/ch92fbc1.aspx
      
    And yeah, I’m late to this party obviously.
      Hope you’ve been well.

  2. 2 Jimmy

    Yeah Mike, been doing well. Hope you have as well…

    As for .NET 2.0, unfortunately not yet, that should be the next project though.

  3. 3 Nathanael

    Yeah heard about this TryParse thing (I’m still on 1.1) but it’s not a solution to all your problems; you’ll still need a wrapper class that probably uses that (once you upgrade to 2.0) at the core, but can also provide additional functionality – like specific error feedback (“Hi idiot, there are only 28 days in February this year – not 67. Try again!”) if you want to go that far.

    I’d help, but I’m busy working on a class library to provide modular AHAH (AJAX subset) client-server integration with auto-degradation, including auto remote content syndication as required … it’s pretty cool (if I finish it)

Leave a Reply