Recognise an arbitrary date string

后端 未结 14 855
抹茶落季
抹茶落季 2020-12-01 16:18

I need to be able to recognise date strings. It doesn\'t matter if I can not distinguish between month and date (e.g. 12/12/10), I just need to classify the string as being

14条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 16:40

    I don't know of any library that does this either. I would suggest a mix of nested recursive functions and regular expressions (a lot) to match strings and try to come up with a best guess to see if it can be a date. Dates can be written in a lot of different ways, some people might write them out as "Sunday, October 3 2010" or "Sunday, October 3rd 2010" or "10/03/2010" or "10/3/2010" and a whole bunch of different ways (even more if you are considering dates in other languages/cultures).

提交回复
热议问题