I'm trying to access the format of a given date value. I need to check whether the format is in dd/mm/yy
or dd/mm/yyyy
. I have used the following patterns with preg_match()
, but they do not work.
'^\d{1,2}\/\d{1,2}\/\d{4}^' // dd/mm/yyyy
'^\d{1,2}\/\d{1,2}\/\d{2}^' // dd/mm/yy
Can someone help me to find the correct pattern?