get date and/or time by pattern