|
Isn't this... quite simple? ?
If the time format is certain, you will find them one by one
Find out that the first four digits are the year, and the sixth and seventh digits are the month... in turn...
Scan the string once it is more complicated. When encountering non-numeric characters, use the previous string as a year or month, etc.
No matter how complicated it is, verify the value
No matter how complicated it is, the date will be automatically modified, for example, 2012-13-11 will automatically become 2013-01-11, etc.
It depends on your needs |
|