d: Day | M: month | y: year |
h: 12 hour | H: 24 hour | m: minute |
s: second | S: millisecond | |
a: am / pm | A: AM / PM | |
/. -: Separators |
var parser = new DateParser("yyyy-MM-dd HH:mm"); alert(parser.format(new Date())); //Result is "2004-07-10 15:30" alert(parser.parse("2004-07-10 15:30")); //Result is a Date alert(parser.parse("ABC")); //Result is a null
Name | Type | Default | Description |
---|---|---|---|
mask | String | The JST_DEFAULT_DATE_MASK value | The date mask |
enforceLength | boolean | The JST_DEFAULT_ENFORCE_LENGTH value | If set to true, each field on the parsed String must have the same length as that field on the mask, ie: yyyy-MM-dd with '99-10-8' would result on a parse error |
completeFieldsWith | Date | null | When set, complete missing field values with the ones of it. Only makes sense when enforceLength is false |
completeFieldsWith | When set, complete missing field values with the ones of it |
enforceLength | If set to true, each field on the parsed String must have the same length as that field on the mask, ie: yyyy-MM-dd with '99-10-8' would result on a parse error |
mask | The date mask |