Skip to content

yangsongbai1/dtxg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dtxg - powerful extensions to dateutil

pypi version supported Python version licence

Join the chat at https://gitter.im/dateutil/dateutil Read the documentation at https://dateutil.readthedocs.io/en/latest/

travis build status appveyor build status azure pipelines build status Code coverage

The dtxg module provides powerful extensions to the standard dateutil module, available in Python.

Installation

dtxg can be installed from PyPI using pip:

pip install dtxg

Download

dtxg is available on PyPI https://pypi.org/project/dtxg/

Code

The code and issue tracker are hosted on Github: https://github.com/yangsongbai1/dtxg/

Features

  • Extensions to the dateutil module to support time resolution in multiple languages
  • Utc time can be returned based on the time zone parameter

Quick example

dtxg can be installed from PyPI using pip:

from dtxg.parser import parse, UtcTime, country_tz

# test2
a = parse(" Thứ ba, 18/6/2019 | 4:41:27 Chiều", language='西班牙语', tzinfo='UTC', country=None, fuzzy=True)
print(a)

# test2
utctime = UtcTime(language='西班牙语', country='中国')
a = utctime.parse(" Thứ ba, 18/6/2019 | 4:41:27 Chiều", fuzzy=True)
print(a)

print(country_tz.country_tz)                    查看各国时区(即country_tz的有效参数)
print(country_tz.country_language)              查看各国语言(即language的有效参数)
pytz.all_timezones                              查看所有地区时区,(即tzinfo的有效参数)

lanauge 传入时间字符串的语言种类
tzinfo  时区
country 国家,用于tzinfo为空时获取时区信息
fuzzy   模糊匹配
返回utc时间
没有解析到时间会抛出异常

可识别 "2019-06-10T08:00:00-05:00"  "UTC", "GMT", "Z", "z"
优先识别字符串中的时区,其次识别tzinfo传入的时区,如果两者都没有,则以传入country的首都时区返回utc时间,
如果都为空,则返回原时间

Contributing

We welcome many types of contributions - bug reports, pull requests (code, infrastructure or documentation fixes). For more information about how to contribute to the project, see the CONTRIBUTING.md file in the repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages