{"id":13937673,"url":"https://github.com/codecov/timestring","last_synced_at":"2025-07-20T00:30:58.140Z","repository":{"id":6377970,"uuid":"7615485","full_name":"codecov/timestring","owner":"codecov","description":"Making time easier since \"Jan 17th, 2013 at 3:59pm\"","archived":true,"fork":false,"pushed_at":"2020-09-21T17:14:52.000Z","size":147,"stargazers_count":101,"open_issues_count":1,"forks_count":26,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-07-10T06:11:40.360Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codecov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-15T00:13:44.000Z","updated_at":"2024-08-02T15:39:22.000Z","dependencies_parsed_at":"2022-08-30T00:51:56.501Z","dependency_job_id":null,"html_url":"https://github.com/codecov/timestring","commit_stats":null,"previous_names":["stevepeak/timestring"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/codecov/timestring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Ftimestring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Ftimestring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Ftimestring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Ftimestring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codecov","download_url":"https://codeload.github.com/codecov/timestring/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Ftimestring/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264905577,"owners_count":23681438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-07T23:03:46.387Z","updated_at":"2025-07-20T00:30:57.785Z","avatar_url":"https://github.com/codecov.png","language":"Python","readme":"# timestring [![Build Status](https://secure.travis-ci.org/codecov/timestring.png)](http://travis-ci.org/stevepeak/timestring) [![Version](https://img.shields.io/pypi/v/timestring.svg)](https://github.com/stevepeak/timestring) [![codecov.io](https://codecov.io/github/stevepeak/timestring/coverage.svg?branch=master)](https://codecov.io/gh/codecov/timestring)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Ftimestring.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Ftimestring?ref=badge_shield)\n\nConverting strings into usable time objects. The time objects, known as `Date` and `Range` have a number of methods that allow \nyou to easily change and manage your users input dynamically.\n\n## Install\n`pip install timestring`\n\n\n## Ranges\n\nRanges are simply two Dates. The first date, `Range().start` and  `Range().end` represent just that, a start and end to a period of time.\nThere are a couple reference points for Ranges.\n\n#### References\n* **no reference** =\u003e `x[ - - - - ]`\n    - Adds the time to today. `Range('1 week')` would be `today + 7 days`\n* `this` =\u003e `[ - - x - - ]`\n    - `this month` is from start of month to end of month. Therefore today **is** included.\n    - ```Range(\"today\") in Range(\"this month\") == True```\n* `next` =\u003e `x [ - - - - ]`\n    - `next 3 weeks` takes today and finds the start of next weeks and continues to contain 3 weeks.\n    - `Range(\"today\") in Range(\"next 5 days\") == False` and `Range(\"tomorrow\") in Range(\"next 5 days\") == True`\n* `ago` =\u003e `[ - - - - ] x`\n    - same as `next` but in the past\n* `last` =\u003e `[ - - - - x ]`\n    - `last 6 days` takes all of Today and encapsulates the last 6 days\n    - ```Range(\"today\") in Range(\"last 6 days\") == True```\n    - empty reference ex `10 days`\n\n#### Samples\nThe 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`\n\n\u003e `this` will look at the references in its entirety\n```python\n\u003e\u003e\u003e Range('this year')\nFrom 01/01/13 00:00:00 to 01/01/14 00:00:00\n```\n\n*Notice how this year is from jan 1s to jan 1st of next year* The full year, all 12 months, is **this year**\n\n\n\u003e `ago` and `last` will reference in the past\n```python\n\u003e\u003e\u003e Range('1 year ago')\nFrom 01/01/11 00:00:00 to 01/01/12 00:00:00\n```\n`1 year ago` is equivalent to `year ago`, and `last year`\n\n*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`\n\n### See examples see the [test file](https://github.com/stevepeak/timestring/blob/master/tests/tests.py)\n\nMore examples / documentation coming soon.\n\n## License\n**timestring** is licensed under the Apache Licence, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).\n\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Ftimestring.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Ftimestring?ref=badge_large)","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecov%2Ftimestring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodecov%2Ftimestring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecov%2Ftimestring/lists"}