日期实用程序,用于猜测给定日期字符串或日期字符串列表的日期格式

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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
junit有没有办法在Java中重新初始化静态类?   在浏览器中点击应用程序时java Play框架挂起   文件Java错误中的NullPointerException   使用Java中的SNMP查找网络中计算机的登录名   java包装服务器引导程序已弃用,有什么替代方案?   当客户在等待理发时,java信号量值是否存在问题?   java如何使用JavaMail仅下载特定类型的附件   如何在java中将十进制转换为十六进制   java Slick2D粒子系统不会生成粒子   java检测更改事件来自何处   将Java集合类型参数类设置为数组   java如何从eclipse导出为可运行JAR文件?   java EntityManager对象未注入Glassfish和Spring   swing从actionPerformed和actionListener Java返回字符串   java在给定另一个等价键对象的情况下获取映射项的当前键   无论输入如何,java网络都会产生相同的输出