I started writing a Javascript library to convert dates in Javascript notation to ColdFusion ODBCDateTime format and back.
One of the first things that I needed to do was to check to see if a client-side ColdFusion ODBCDateTime was being returned from the server. To do this I created a Regular Expression in Javascript to make sure that the value was indeed a valid ODBCDateTime object.
Here is the Regular Expression that I used.
/^[{ts]+\s+[']+\d{4}(\-)+[0-1][0-9](\-)+[0-3][0-9]+\s+[0-2][0-9](\:)[0-5][0-9](\:)[0-5][0-9]['][}]/gi
To test that a date being returned by my server is in ODBCDateTime format I created this test:
var isODBCDateTime = /^[{ts]+\s+[']+\d{4}(\-)+[0-1][0-9](\-)+[0-3][0-9]+\s+[0-2][0-9](\:)[0-5][0-9](\:)[0-5][0-9]['][}]/gi.test( <em>date to test</em> );