Arrow is a time-and-date library, simple and easy to use. Support python3.6
Https://arrow.readthedocs.io/en/latest/arrow Official Website API
Https://github.com/crsmithdev/arrow Arrow's GitHub hosted address
http://www.iplaypy.com/module/m111.html Third party time Date library Python arrow module
Installation:
Pip Install arrow
#-*-coding:utf-8-*-#Coding=utf-8ImportArrow#local = utc.to (' us/pacific ') # Time zone modification#local = utc.to (' Asia/shanghai ') # Time zone modificationlocal = Arrow.now ('local') # Gets the current time (recommended) Print(local)Print('-------------')#time Increase or decreasePrint(Local.replace (Years=-1))Print(Local.replace (Months=-1))Print(Local.replace (days=-5))Print(Local.replace (hours=-24))Print(Local.replace (minutes=-10))Print(Local.replace (seconds=-60))Print('-------------')#String Turn TimePrint(Arrow.get ('2017-10-28t00:00:00+0800'))#Print (Arrow.get (' 2017-10-28 ', ' Yyyy-mm-dd ')) # string turn time (not recommended, no time zone) Print(arrow.get ('2017-10-28', 'yyyy-mm-dd', tzinfo='local') # (recommended) Print(Arrow.get ('2017-10-28','YYYY-MM-DD', tzinfo='Asia/shanghai'))#This can also Print(arrow.get ('2017-10-28 05:30:30', 'yyyy-mm-dd hh:mm: SS', tzinfo='local') # (recommended) Print('-------------')#time Stamp Print(local.timestamp) # timestamp print(arrow.get ('1509120000 ', tzinfo='local') # Timestamp string, converted to the time of the current time zone #time converted to string, output (formatted) Print(Local.format ("yyyy-mm-dd"))print(Local.format ( " YYYY-MM-DD HH:mm:ss " ))Print(Local.replace (Minutes=-1). humanize (locale='ZH'))#Localized personality time phrases: just 1 minutes ago, 1 days ago, etc (zh_tw more language support, go to view arrow/locales.py)
Arrow Main Features:
1. Time zone Conversion
2. Simple timestamp operation
3. Time span
4, very user-friendly, support more and more language environment
5. Implement the DateTime interface
6. Support Python 2.6, 2.7 and 3.3
7. Tz-aware and UTC are used by default
8, create a concise, intelligent interface
9, can be easily changed and change the properties
10. Rich parsing and formatting options
11. Extensible factory architecture to support custom arrow derivation types
...
Python Library: arrow (TIME)