I would like to detect all time like strings in a webpage, and then use strtotime() in php to get unix time stamps. Is there a way to detect time like strings using php. I could use regex for a particular page, but I am seeking something universal or at least something that detects most of the possible formats of time/date strings? Thanks for reading this.
this is nice, but limited
Matching a time string with a regular expression
Similar question here:
How to convert String to Date without knowing the format?
The consensus is that you need to know the incoming format. You also could attempt to match the incoming string against a discreet list of known formats first in attempt to determine the format. You hinted at this with mentioning regex in your question. Those are really the only two ways.