XmlGrid Users Forum
2012-05-23 11:25:51
I need a regular expression to match XML dateTime data type, preferably in javascript. The dateTime is in the following format:

YYYY-MM-DDThh:mm:ss 
Or:
YYYY-MM-DDThh:mm:ssZ

Thanks for any answers.
;3418;2012-05-23 11:25:51__s__
I need a regular expression to match XML dateTime data type, preferably in javascript. The dateTime is in the following format:

YYYY-MM-DDThh:mm:ss 
Or:
YYYY-MM-DDThh:mm:ssZ

Thanks for any answers.
__s__~u=Jim~site=NULL__s__ Regular expression to match XML DateTime data type__s____m__2012-05-30 17:32:48__s__This function will check if a string is a valid XML DateTime:

__code__
function isDatetime(str)
{
  var re =  new RegExp("^([0-9]{4})-([0-1][0-9])-([0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9](Z)?)$");
if(str.match(re)) 
return true; /* a valid xml dateTime string */
else 
return false;
};
__code__

Hope this will help.
Cheers.

__s__~u=Zac~site=NULL__s__ __s____m__2013-01-14 01:48:52__s__
__s__~u=ykyk~site=NULL__s__ __s____m__

Best view with Google Chrome