{"id":18319755,"url":"https://github.com/developerrsquared/datetime-helpers","last_synced_at":"2025-10-03T13:57:27.192Z","repository":{"id":37956864,"uuid":"440841865","full_name":"DeveloperRSquared/datetime-helpers","owner":"DeveloperRSquared","description":"A handy collection of datetime utils.","archived":false,"fork":false,"pushed_at":"2025-09-22T17:08:52.000Z","size":206,"stargazers_count":2,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-23T10:46:01.763Z","etag":null,"topics":["datetime","python","python3","tooling","utils"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/datetime-helpers/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DeveloperRSquared.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["rikhilrai"],"custom":"https://www.paypal.me/rikhilrai"}},"created_at":"2021-12-22T11:54:19.000Z","updated_at":"2023-07-25T17:59:47.000Z","dependencies_parsed_at":"2023-02-01T06:31:19.007Z","dependency_job_id":"58fd760a-a0ae-4551-8ce9-3f3adf7a5495","html_url":"https://github.com/DeveloperRSquared/datetime-helpers","commit_stats":{"total_commits":82,"total_committers":3,"mean_commits":"27.333333333333332","dds":0.4878048780487805,"last_synced_commit":"3ebb8ae306b3b34094f587e8e8fad81d37ac78b8"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/DeveloperRSquared/datetime-helpers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperRSquared%2Fdatetime-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperRSquared%2Fdatetime-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperRSquared%2Fdatetime-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperRSquared%2Fdatetime-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeveloperRSquared","download_url":"https://codeload.github.com/DeveloperRSquared/datetime-helpers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperRSquared%2Fdatetime-helpers/sbom","scorecard":{"id":39934,"data":{"date":"2025-08-11","repo":{"name":"github.com/DeveloperRSquared/datetime-helpers","commit":"eb62fc2c51ac12331c786a48ed267282302fc622"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/1 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/DeveloperRSquared/datetime-helpers/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/DeveloperRSquared/datetime-helpers/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/DeveloperRSquared/datetime-helpers/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/DeveloperRSquared/datetime-helpers/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/DeveloperRSquared/datetime-helpers/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/DeveloperRSquared/datetime-helpers/codeql-analysis.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish-test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/DeveloperRSquared/datetime-helpers/publish-test.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/DeveloperRSquared/datetime-helpers/publish.yml/main?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:18","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:19","Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/publish-test.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2024-48 / GHSA-fj7x-q9j7-g6q6","Warn: Project is vulnerable to: PYSEC-2025-49 / GHSA-5rjg-fvgr-3xxf","Warn: Project is vulnerable to: GHSA-cx63-2mw6-8hw5","Warn: Project is vulnerable to: PYSEC-2024-187 / GHSA-rqc4-2hc7-8c8v","Warn: Project is vulnerable to: GHSA-jfmj-5v4g-7637"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-14T21:14:56.857Z","repository_id":37956864,"created_at":"2025-08-14T21:14:56.857Z","updated_at":"2025-08-14T21:14:56.857Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278173363,"owners_count":25942293,"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","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["datetime","python","python3","tooling","utils"],"created_at":"2024-11-05T18:14:09.920Z","updated_at":"2025-10-03T13:57:27.165Z","avatar_url":"https://github.com/DeveloperRSquared.png","language":"Python","readme":"# Datetime Helpers\n\nA handy collection of datetime utils.\n\n[![Publish](https://github.com/DeveloperRSquared/datetime-helpers/actions/workflows/publish.yml/badge.svg)](https://github.com/DeveloperRSquared/datetime-helpers/actions/workflows/publish.yml)\n\n[![Python 3.7+](https://img.shields.io/badge/python-3.7+-brightgreen.svg)](#datetime-helpers)\n[![PyPI - License](https://img.shields.io/pypi/l/datetime-helpers.svg)](LICENSE)\n[![PyPI - Version](https://img.shields.io/pypi/v/datetime-helpers.svg)](https://pypi.org/project/datetime-helpers)\n\n[![CodeQL](https://github.com/DeveloperRSquared/datetime-helpers/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/DeveloperRSquared/datetime-helpers/actions/workflows/codeql-analysis.yml)\n[![codecov](https://codecov.io/gh/DeveloperRSquared/datetime-helpers/branch/main/graph/badge.svg?token=UI5ZDDDXXB)](https://codecov.io/gh/DeveloperRSquared/datetime-helpers)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/DeveloperRSquared/datetime-helpers/main.svg)](https://results.pre-commit.ci/latest/github/DeveloperRSquared/datetime-helpers/main)\n\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat\u0026labelColor=ef8336)](https://pycqa.github.io/isort/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n\n## Install\n\nInstall and update using [pip](https://pypi.org/project/datetime-helpers/).\n\n```sh\n$ pip install -U datetime-helpers\n```\n\n## What's available?\n\n```py\nimport datetime_helpers\n\n# Given a datetime:\n\u003e\u003e\u003e dt = datetime.date(2017, 4, 17)\n\n# Check the day of week\n\u003e\u003e\u003e datetime_helpers.get_day_of_week(dt=dt)\n'Monday'\n\n# Check if it is a weekend\n\u003e\u003e\u003e datetime_helpers.is_weekend(dt=dt)\nFalse\n\n# Check if it is a weekday\n\u003e\u003e\u003e datetime_helpers.is_weekday(dt=dt)\nTrue\n\n# Get the previous business day\n\u003e\u003e\u003e datetime_helpers.get_previous_business_day(dt=dt)\ndatetime.date(2017, 4, 14)\n\n# Get the next business day\n\u003e\u003e\u003e datetime_helpers.get_next_business_day(dt=dt)\ndatetime.date(2017, 4, 18)\n\n# Get the first business day of the month\n\u003e\u003e\u003e datetime_helpers.get_first_business_day_of_month(dt=dt)\ndatetime.date(2017, 4, 3)\n\n# Get the nth business day of the month\n\u003e\u003e\u003e n = 3  # e.g. third business day\n\u003e\u003e\u003e datetime_helpers.get_nth_business_day_of_month(dt=dt, n=n)\ndatetime.date(2017, 4, 5)\n\n# Convert to a datetime string with custom format (defaults to JSON date format)\n\u003e\u003e\u003e datetime_helpers.datetime_to_string(dt=dt)\n'2017-04-17T00:00:00.000000Z'\n\n# Convert to a date string with custom format (defaults to YYYY-MM-DD)\n\u003e\u003e\u003e datetime_helpers.date_to_string(dt=dt)\n'2017-04-17'\n\n# Convert a string with custom format to datetime (defaults to JSON date format)\n\u003e\u003e\u003e text = '2016-04-17T00:00:00.000000Z'\n\u003e\u003e\u003e datetime_helpers.datetime_from_string(text=text)\ndatetime.datetime(2016, 4, 17, 0, 0)\n\n# Convert a string with custom format to datetime (defaults to JSON date format)\n\u003e\u003e\u003e text = '2016-04-17T00:00:00.000000Z'\n\u003e\u003e\u003e datetime_helpers.datetime_from_string(text=text)\ndatetime.datetime(2016, 4, 17, 0, 0)\n\n# Convert a windows filetime to datetime\n\u003e\u003e\u003e windows_filetime = 116444736000000000\n\u003e\u003e\u003e datetime_helpers.datetime_from_windows_filetime(windows_filetime=windows_filetime)\ndatetime.datetime(1970, 1, 1, 0, 0)\n\n# Convert to seconds\n\u003e\u003e\u003e datetime_helpers.datetime_to_seconds(dt=dt)\n1492387200.0\n\n# Convert seconds to datetime\n\u003e\u003e\u003e seconds = 1492387200\n\u003e\u003e\u003e datetime_helpers.datetime_from_seconds(seconds=seconds)\ndatetime.datetime(2017, 4, 17, 0, 0)\n\n# Convert to millis\n\u003e\u003e\u003e datetime_helpers.datetime_to_millis(dt=dt)\n1492387200000\n\n# Convert millis to datetime\n\u003e\u003e\u003e millis = 1492387200000\n\u003e\u003e\u003e datetime_helpers.datetime_from_millis(millis=millis)\ndatetime.datetime(2017, 4, 17, 0, 0)\n\n# Convert date to datetime\n\u003e\u003e\u003e datetime_helpers.datetime_from_date(dt=dt)\ndatetime.datetime(2017, 4, 17, 0, 0)\n```\n\n## Contributing\n\nContributions are welcome via pull requests.\n\n### First time setup\n\n```sh\n$ git clone git@github.com:DeveloperRSquared/datetime-helpers.git\n$ cd datetime-helpers\n$ poetry install\n$ poetry shell\n```\n\nTools including black, mypy etc. will run automatically if you install [pre-commit](https://pre-commit.com) using the instructions below\n\n```sh\n$ pre-commit install\n$ pre-commit run --all-files\n```\n\n### Running tests\n\n```sh\n$ poetry run pytest\n```\n\n## Links\n\n- Source Code: \u003chttps://github.com/DeveloperRSquared/datetime-helpers/\u003e\n- PyPI Releases: \u003chttps://pypi.org/project/datetime-helpers/\u003e\n- Issue Tracker: \u003chttps://github.com/DeveloperRSquared/datetime-helpers/issues/\u003e\n","funding_links":["https://github.com/sponsors/rikhilrai","https://www.paypal.me/rikhilrai"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloperrsquared%2Fdatetime-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeveloperrsquared%2Fdatetime-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloperrsquared%2Fdatetime-helpers/lists"}