日期实用程序,用于猜测给定日期字符串或日期字符串列表的日期格式
date-tools的Python项目详细描述
日期工具
作者:Henin Roland Karkada
date_tools提供一个集成的日期实用程序集合,帮助您猜测任何给定日期字符串/列表的日期格式
安装:
$ pip install date-tools
用法:
guess_date_format() -> Expects a single date/ List of dates
$ from date_tools import date_guesser
a) Single date:
Example 1: $ date_guesser.guess_date_format("22/03/2018") Output: '%d/%m/%Y'
Example 2: $ date_guesser.guess_date_format("14 03 18") Output: '%d %m %y'
Example 3: $ date_guesser.guess_date_format("13-Mar-2018") Output: '%d-%b-%Y'
Example 4: $ date_guesser.guess_date_format("31/March/18") Output: '%d/%B/%y'
Example 5: $ date_guesser.guess_date_format("22/03/2018") Output: '%d/%m/%Y'
Example 6: $ date_guesser.guess_date_format("31 03 2017") Output: '%d %m %Y'
Example 7: $ date_guesser.guess_date_format("03/2018") Output: '%m/%Y'
Example 8: $ date_guesser.guess_date_format("March/2018") Output: '%B/%Y'
b) List of dates:
Example 1: $ date_guesser.guess_date_format(["02 March 2018", "12 May 2018","10 December 2018", "22/03/1988"]) Output: '%d %B %Y' --> Returned as '%d %B %Y' was the date format matched with majority of the items
其他详细信息可在示例文件夹中找到
提供最新工具
如果您想为date_工具贡献代码,请查看contribution.md。