Get date and/or time by pattern.