
March 28th, 2012, 11:05 AM
|
|
Contributing User
|
|
Join Date: Oct 2011
Posts: 64
  
Time spent in forums: 13 h 33 m 11 sec
Reputation Power: 3
|
|
Quote: | Originally Posted by requinix Those can be simplified.
Code:
time ^([01]?\d|2[0-3]):[0-5]\d:[0-5]\d$
date ^[12]\d\d\d:(0\d|1[012]):([012]\d|3[01])$
(\d is equivalent to [0-9])
The time one is perfect but the date one requires more validation. |
PHP Code:
^[12]\d\d\d:(0\d|1[012]):([012]\d|3[01])$
Will this be military format, though? If not, how would I know the difference in AM or PM? I've always just used military time to calculate. also, I'm trying to get the format in YYYY-MM-DD. I'm used to MySQL style databases, but I'm switching to the .Net world and working with SQL Server 2008, now.
*** This is an MVC3 app, also. Just throwing that out there.
|