{"repo":"nickmaccarthy/python-datemath","free":true,"listed":false,"github":"https://github.com/nickmaccarthy/python-datemath","clone":"git clone https://github.com/nickmaccarthy/python-datemath.git","description":"A python module to emulate the date math used in SOLR and Elasticsearch","language":"Python","stars":46,"topics":["datemath","elasticsearch","solr","python","date","math","math-expressions","datetime","arrow"],"license":"Apache-2.0","category":"data-pipelines","readme_excerpt":"Python Datemath Parse Elasticsearch-style date math in Python with clean timezone-aware results. Date math is the compact syntax used by systems like Elasticsearch, Splunk and Solr for expressions such as now-15m , now/d , or 2024-01-01 +1M . python-datemath brings that same style to Python and returns proper timezone-aware values you can keep as Arrow , convert to datetime , or render as timestamps. Why use it? - Familiar Elasticsearch, Splunk, Datadog and Solr-style expressions - Timezone-aware parsing and arithmetic - Support for rounding like /d , /w , and /M - Works with Arrow , datetime , and unix timestamps - Small library, simple API, no framework required Quick Start Python 3.10+ is supported. At A Glance What Is Date Math? Date math is shorthand arithmetic for finding times relative to a fixed moment. An expression is made of: 1. An anchor, either now or a timestamp ending in 2. Zero or more operations using + , - , or / 3. A supported time unit such as year, month, week, day, hour, minute, or second Examples: - now+1h - now+1h+1m - now+1h/d - 2012-01-01 +1M/d When roundDown=False , rounding uses the end of the interval instead of the beginning. Supported Units Usage Return an Arrow object dm() returns an Arrow object by default. If you want a string, use Arrow's .format() method. Return a standard datetime Use datemath() if you want a standard Python datetime . You can also use dm() with type=\"datetime\" : Return a unix timestamp Timezones By default, returned value","default_branch":null,"files":null,"tree":[],"storefront":"/r/nickmaccarthy","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/nickmaccarthy/python-datemath/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}