百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

timestring

> 编程语言
开源

自"2013 年 1 月 17 日下午 3:59"起,时间变得更加容易

100 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

自"2013 年 1 月 17 日下午 3:59"起,时间变得更加容易

timestring

Converting strings into usable time objects. The time objects, known as Date and Range have a number of methods that allow you to easily change and manage your users input dynamically.

Install

pip install timestring

Ranges

Ranges are simply two Dates. The first date, Range().start and Range().end represent just that, a start and end to a period of time. There are a couple reference points for Ranges.

References

  • no reference => x[ - - - - ]
    • Adds the time to today. Range('1 week') would be today + 7 days
  • this => [ - - x - - ]
    • this month is from start of month to end of month. Therefore today is included.
    • Range("today") in Range("this month") == True
  • next => x [ - - - - ]
    • next 3 weeks takes today and finds the start of next weeks and continues to contain 3 weeks.
    • Range("today") in Range("next 5 days") == False and Range("tomorrow") in Range("next 5 days") == True
  • ago => [ - - - - ] x
    • same as next but in the past
  • last => [ - - - - x ]
    • last 6 days takes all of Today and encapsulates the last 6 days
    • Range("today") in Range("last 6 days") == True
    • empty reference ex 10 days

Samples

The examples below all work with the following terms minute, hour, day, month and year work for the examples below. fyi Today is 5/14/2013

this will look at the references in its entirety

python
>>> Range('this year')
From 01/01/13 00:00:00 to 01/01/14 00:00:00

Notice how this year is from jan 1s to jan 1st of next year The full year, all 12 months, is this year

ago and last will reference in the past

python
>>> Range('1 year ago')
From 01/01/11 00:00:00 to 01/01/12 00:00:00

1 year ago is equivalent to year ago, and last year

Note you add more years like this 5 years ago which will be From 01/01/07 00:00:00 to 01/01/08 00:00:00

See examples see the test file

More examples / documentation coming soon.

License

timestring is licensed under the Apache Licence, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).

Issues· 1 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Python

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言