Posted By

lance on 05/08/12


Tagged


Versions (?)

Regular expression for smalldatetime in SQL


 / Published in: Regular Expression
 

This only constraint here for smalldatetime is the year which allows 1900-2079. This does allow normal months and days so you could go outside the smalldatetime since that allows only 1/1/1900-6/6/2079.

  1. ^(([1-9])|(0[1-9])|(1[0-2]))\/(([0-9])|([0-2][0-9])|(3[0-1]))\/(([1][9][0-9][0-9])|([2][0][0-7][0-9]))$

Report this snippet  

You need to login to post a comment.