Click here to Skip to main content
Click here to Skip to main content

Validating dates in dd-MMM-yyyy format

By , 13 May 2010
 
Less magic, more readable, would be:
DateTime dt1;
DateTime dt2;
if (DateTime.TryParseExact(str1, "dd-MMM-yyyy", null, DateTimeStyles.None, out dt1) &&
    DateTime.TryParseExact(str2, "dd-MMM-yyyy", null, DateTimeStyles.None, out dt2)) {
	// do something with those datetimes
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Luc Pattyn
Software Developer (Senior) Perceler
Belgium Belgium
Member
I am an engineer with a background in electronics, software and mathematics.
 
I develop technical software, both for embedded systems and for desktop equipment. This includes operating systems, communication software, local networks, image processing, machine control, automation, etc.
 
I have been using all kinds of microcontrollers and microprocessors (Intel 4004/8080/8051/80386/Pentium, Motorola 680x/680x0/ColdFire/PowerPC, Microchip PIC, Altera NIOS, and many more), lots of programming languages (all relevant assemblers, Fortran, Basic, C, Java, C#, and many more), and different operating systems (both proprietary and commercial).
 
For desktop applications and general development tools I have been using both UNIX systems and Mac/MacOS for many years, but I have switched to x86-based PCs with Windows, Visual Studio and the .NET Framework several years ago.
 
I specialize in:
- cross-platform development (making software that runs on diverse hardware/OS combinations)
- instruction set simulation
- improving software performance, i.e. making sure the software runs the job at hand in as short a time as possible on the given hardware. This entails algorithm selection, implementation design, accurate measurements, code optimisation, and sometimes implementing virtual machines, applying SIMD technology (such as MMX/SSE), and more.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionReason for vote 5memberbilal7869913 Feb '13 - 7:44 
GeneralMy vote of 5membernikhil _singh1 May '12 - 18:29 
GeneralReason for my vote of 5 Fine onemvpthatraja5 Mar '11 - 16:17 
GeneralReason for my vote of 5 I love it readable ;)memberraddde13 Aug '10 - 4:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 13 May 2010
Article Copyright 2010 by Luc Pattyn
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid