Regular expression for smalldatetime in SQL

/ Published in: Regular Expression
Save to your folder(s)

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.

Copy this code and paste it in your HTML
  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


RSS Icon Subscribe to comments

You need to login to post a comment.