npdatetime


Namenpdatetime JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/4mritGiri/npdatetime
SummaryA Python package that provides advanced functionality for handling Nepali dates and times, including support for the Bikram Sambat calendar system and Nepal Time (NPT). Ideal for developers working with Nepali date-related applications, offering seamless conversion, manipulation, and formatting of dates and times in the Nepali calendar.
upload_time2025-01-04 18:02:33
maintainerNone
docs_urlNone
authorAmrit Giri
requires_python>=3.5
licenseThe MIT License (MIT) Copyright © 2020 AMRIT GIRI Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords nepali date date conversion datetime bikram sambat bikram samvat nepali b.s. bs bs b.s date npdatetime datetime time timezone nepal bikram sambat samvat nepali-date nepali-datetime nepal-time npt nepal-timezone npdatetime npdt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # **Nepali Datetime (Bikram Sambat Date & Nepal Time)**

A Python library inspired by the core `datetime` module, designed for operations based on the **Bikram Sambat (B.S.)** calendar and **Nepal Time (NPT)** timezone (`UTC+05:45`).

### **Key Features**
- Supports Bikram Sambat (B.S.) date operations.
- Handles Nepal Time (NPT) timezone.
- Compatible with Python 3.5+.
- Seamless integration with Python's native `datetime` functionalities.
- Support for date formatting with Nepali Unicode.

---

## **Installation**

Install the package using `pip`:

```bash
pip install npdatetime
```

---

## **Basic Usage**

Here's how you can use `npdatetime` alongside Python's `datetime`:

### **Importing**
```python
import datetime
import npdatetime
```

### **Getting Today's Date**
```python
# Gregorian date
datetime.date.today()

# Bikram Sambat date
npdatetime.date.today()
```

### **Current Date and Time**
```python
# Gregorian datetime
datetime.datetime.now()

# Bikram Sambat datetime
npdatetime.datetime.now()
```

### **Creating Date and Datetime Objects**
```python
# Gregorian date
datetime.date(2020, 9, 4)

# Bikram Sambat date
npdatetime.date(2077, 5, 19)

# Gregorian datetime
datetime.datetime(2020, 9, 4, 8, 26, 10, 123456)

# Bikram Sambat datetime
npdatetime.datetime(2077, 5, 19, 8, 26, 10, 123456)
```

### **Date/Datetime Formatting**
```python
# Formatting Bikram Sambat date
npdatetime.datetime(2077, 5, 19, 8, 26, 10, 123456).strftime("%d %B %Y")
# Output: 19 Bhadau 2077

# Formatting with Nepali Unicode
npdatetime.date(1977, 10, 25).strftime('%K-%n-%D (%k %N %G)')
# Output: १९७७-१०-२५ (७७ माघ आइतबार)
```

### **Parsing from String**
```python
npdatetime.datetime.strptime('2077-09-12', '%Y-%m-%d')
# Output: npdatetime.datetime(2077, 9, 12, 0, 0)
```

### **Timedelta Operations**
```python
# Adding days to a date
npdatetime.date(1990, 5, 10) + datetime.timedelta(days=350)
# Output: npdatetime.date(1991, 4, 26)

# Adding hours and minutes to a datetime
npdatetime.datetime(1990, 5, 10, 5, 10, 20) + datetime.timedelta(hours=3, minutes=15)
# Output: npdatetime.datetime(1990, 5, 10, 8, 25, 20)
```

### **Bikram Sambat <-> Gregorian Conversion**
```python
# Convert Bikram Sambat to Gregorian
npdatetime.date(1999, 7, 25).to_datetime_date()
# Output: datetime.date(1942, 11, 10)

# Convert Gregorian to Bikram Sambat
npdatetime.date.from_datetime_date(datetime.date(1942, 11, 10))
# Output: npdatetime.date(1999, 7, 25)
```

### **Bikram Sambat Monthly Calendar**
```python
npdatetime.date(2078, 1, 1).calendar()

# Output:
          Baishakh 2078
Sun  Mon  Tue  Wed  Thu  Fri  Sat
                1    2    3    4
5     6    7    8    9   10   11
12   13   14   15   16   17   18
19   20   21   22   23   24   25
26   27   28   29   30   31
```

---

## **Documentation**

Comprehensive usage and examples can be found in the [official documentation](https://4mritGiri.github.io/npdatetime/).

---

## **Contribution**

Contributions are highly encouraged!  
Refer to the [CONTRIBUTING.md](https://github.com/4mritGiri/npdatetime/blob/master/CONTRIBUTING.md) guide for details on how to get started.

---

## **License**

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.

---

## **Feedback & Support**

For feature requests, bugs, or feedback, please raise an issue on [GitHub](https://github.com/4mritGiri/npdatetime/issues).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/4mritGiri/npdatetime",
    "name": "npdatetime",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": null,
    "keywords": "Nepali Date, Date Conversion, Datetime, Bikram Sambat, Bikram Samvat, nepali, B.S., BS, bs, b.s, date, NpDateTime, datetime, time, timezone, nepal, bikram, sambat, samvat, nepali-date, nepali-datetime, nepal-time, npt, nepal-timezone, npdatetime, npdt",
    "author": "Amrit Giri",
    "author_email": "Amrit Giri <amritgiri02595@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/67/e6/5dc6192399da24cf31e65db5172a0c1a90d424b6ef53c88834cdc0f5fbc9/npdatetime-0.1.1.tar.gz",
    "platform": null,
    "description": "# **Nepali Datetime (Bikram Sambat Date & Nepal Time)**\n\nA Python library inspired by the core `datetime` module, designed for operations based on the **Bikram Sambat (B.S.)** calendar and **Nepal Time (NPT)** timezone (`UTC+05:45`).\n\n### **Key Features**\n- Supports Bikram Sambat (B.S.) date operations.\n- Handles Nepal Time (NPT) timezone.\n- Compatible with Python 3.5+.\n- Seamless integration with Python's native `datetime` functionalities.\n- Support for date formatting with Nepali Unicode.\n\n---\n\n## **Installation**\n\nInstall the package using `pip`:\n\n```bash\npip install npdatetime\n```\n\n---\n\n## **Basic Usage**\n\nHere's how you can use `npdatetime` alongside Python's `datetime`:\n\n### **Importing**\n```python\nimport datetime\nimport npdatetime\n```\n\n### **Getting Today's Date**\n```python\n# Gregorian date\ndatetime.date.today()\n\n# Bikram Sambat date\nnpdatetime.date.today()\n```\n\n### **Current Date and Time**\n```python\n# Gregorian datetime\ndatetime.datetime.now()\n\n# Bikram Sambat datetime\nnpdatetime.datetime.now()\n```\n\n### **Creating Date and Datetime Objects**\n```python\n# Gregorian date\ndatetime.date(2020, 9, 4)\n\n# Bikram Sambat date\nnpdatetime.date(2077, 5, 19)\n\n# Gregorian datetime\ndatetime.datetime(2020, 9, 4, 8, 26, 10, 123456)\n\n# Bikram Sambat datetime\nnpdatetime.datetime(2077, 5, 19, 8, 26, 10, 123456)\n```\n\n### **Date/Datetime Formatting**\n```python\n# Formatting Bikram Sambat date\nnpdatetime.datetime(2077, 5, 19, 8, 26, 10, 123456).strftime(\"%d %B %Y\")\n# Output: 19 Bhadau 2077\n\n# Formatting with Nepali Unicode\nnpdatetime.date(1977, 10, 25).strftime('%K-%n-%D (%k %N %G)')\n# Output: \u0967\u096f\u096d\u096d-\u0967\u0966-\u0968\u096b (\u096d\u096d \u092e\u093e\u0918 \u0906\u0907\u0924\u092c\u093e\u0930)\n```\n\n### **Parsing from String**\n```python\nnpdatetime.datetime.strptime('2077-09-12', '%Y-%m-%d')\n# Output: npdatetime.datetime(2077, 9, 12, 0, 0)\n```\n\n### **Timedelta Operations**\n```python\n# Adding days to a date\nnpdatetime.date(1990, 5, 10) + datetime.timedelta(days=350)\n# Output: npdatetime.date(1991, 4, 26)\n\n# Adding hours and minutes to a datetime\nnpdatetime.datetime(1990, 5, 10, 5, 10, 20) + datetime.timedelta(hours=3, minutes=15)\n# Output: npdatetime.datetime(1990, 5, 10, 8, 25, 20)\n```\n\n### **Bikram Sambat <-> Gregorian Conversion**\n```python\n# Convert Bikram Sambat to Gregorian\nnpdatetime.date(1999, 7, 25).to_datetime_date()\n# Output: datetime.date(1942, 11, 10)\n\n# Convert Gregorian to Bikram Sambat\nnpdatetime.date.from_datetime_date(datetime.date(1942, 11, 10))\n# Output: npdatetime.date(1999, 7, 25)\n```\n\n### **Bikram Sambat Monthly Calendar**\n```python\nnpdatetime.date(2078, 1, 1).calendar()\n\n# Output:\n          Baishakh 2078\nSun  Mon  Tue  Wed  Thu  Fri  Sat\n                1    2    3    4\n5     6    7    8    9   10   11\n12   13   14   15   16   17   18\n19   20   21   22   23   24   25\n26   27   28   29   30   31\n```\n\n---\n\n## **Documentation**\n\nComprehensive usage and examples can be found in the [official documentation](https://4mritGiri.github.io/npdatetime/).\n\n---\n\n## **Contribution**\n\nContributions are highly encouraged!  \nRefer to the [CONTRIBUTING.md](https://github.com/4mritGiri/npdatetime/blob/master/CONTRIBUTING.md) guide for details on how to get started.\n\n---\n\n## **License**\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.\n\n---\n\n## **Feedback & Support**\n\nFor feature requests, bugs, or feedback, please raise an issue on [GitHub](https://github.com/4mritGiri/npdatetime/issues).\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT) Copyright \u00a9 2020 AMRIT GIRI  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u201cSoftware\u201d), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A Python package that provides advanced functionality for handling Nepali dates and times, including support for the Bikram Sambat calendar system and Nepal Time (NPT). Ideal for developers working with Nepali date-related applications, offering seamless conversion, manipulation, and formatting of dates and times in the Nepali calendar.",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/4mritGiri/npdatetime#readme",
        "Issues": "https://github.com/4mritGiri/npdatetime/issues"
    },
    "split_keywords": [
        "nepali date",
        " date conversion",
        " datetime",
        " bikram sambat",
        " bikram samvat",
        " nepali",
        " b.s.",
        " bs",
        " bs",
        " b.s",
        " date",
        " npdatetime",
        " datetime",
        " time",
        " timezone",
        " nepal",
        " bikram",
        " sambat",
        " samvat",
        " nepali-date",
        " nepali-datetime",
        " nepal-time",
        " npt",
        " nepal-timezone",
        " npdatetime",
        " npdt"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9c9fdaa0e95697be2f1f18d0b9d48fe4b478c91a11a8d79fec2df6507fbe49b8",
                "md5": "f8b4d886e4b08db27254bc280898c4af",
                "sha256": "9071157e60bc35c1ce754ca2ce02124e927edcee139469ab3bc110a1042e5046"
            },
            "downloads": -1,
            "filename": "npdatetime-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f8b4d886e4b08db27254bc280898c4af",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 20575,
            "upload_time": "2025-01-04T18:02:30",
            "upload_time_iso_8601": "2025-01-04T18:02:30.501079Z",
            "url": "https://files.pythonhosted.org/packages/9c/9f/daa0e95697be2f1f18d0b9d48fe4b478c91a11a8d79fec2df6507fbe49b8/npdatetime-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "67e65dc6192399da24cf31e65db5172a0c1a90d424b6ef53c88834cdc0f5fbc9",
                "md5": "9ffde3a312974c43ad5e97503eb65713",
                "sha256": "df9fdd369b0e89c292f98bf443b33881a750e84595e89be38bb5143a3e1d86e0"
            },
            "downloads": -1,
            "filename": "npdatetime-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "9ffde3a312974c43ad5e97503eb65713",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 25077,
            "upload_time": "2025-01-04T18:02:33",
            "upload_time_iso_8601": "2025-01-04T18:02:33.262447Z",
            "url": "https://files.pythonhosted.org/packages/67/e6/5dc6192399da24cf31e65db5172a0c1a90d424b6ef53c88834cdc0f5fbc9/npdatetime-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-04 18:02:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "4mritGiri",
    "github_project": "npdatetime",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "npdatetime"
}
        
Elapsed time: 0.43119s