Introduction
The Nepali Date Conversion API provides a simple and reliable way to convert dates between the Bikram Sambat (BS) calendar and the Gregorian (AD) calendar. This API is perfect for applications that need to handle Nepali dates accurately.
https://sudhanparajuli.com.np/api
Features
- Convert BS dates to AD dates
- Convert AD dates to BS dates
- RESTful API with JSON responses
- GET endpoints with JSON responses
- Comprehensive error handling
- CORS enabled for web applications
Rate Limits
Currently, there are no rate limits imposed on the API. However, please use the API responsibly and avoid excessive requests.
Authentication
No authentication is required to use this API. All endpoints are publicly accessible.
API Endpoints
All endpoints return JSON responses. The API supports GET methods for date conversion.
GET
/api/bs-to-ad/{year}/{month}/{day}
Convert BS date to AD date using URL parameters.
URL Parameters
Parameter | Type | Description |
---|---|---|
year |
integer | BS year |
month |
integer | BS month (1-12) |
day |
integer | BS day (1-31) |
Example Request
GET /api/bs-to-ad/2080/1/1
Response
{
"success": true,
"input": {
"year": 2080,
"month": 1,
"day": 1,
"type": "BS"
},
"result": {
"year": 2023,
"month": 4,
"day": 13,
"type": "AD"
}
}
GET
/api/ad-to-bs/{year}/{month}/{day}
Convert AD date to BS date using URL parameters.
URL Parameters
Parameter | Type | Description |
---|---|---|
year |
integer | AD year |
month |
integer | AD month (1-12) |
day |
integer | AD day (1-31) |
Example Request
GET /api/ad-to-bs/2023/4/13
Response
{
"success": true,
"input": {
"year": 2023,
"month": 4,
"day": 13,
"type": "AD"
},
"result": {
"year": 2080,
"month": 1,
"day": 1,
"type": "BS"
}
}
Quick Code Example
Choose a language to see how to call the GET endpoints.
# BS to AD
curl https://sudhanparajuli.com.np/api/bs-to-ad/2080/1/1
# AD to BS
curl https://sudhanparajuli.com.np/api/ad-to-bs/2023/4/13
Error Handling
The API uses standard HTTP status codes to indicate success or failure of requests.
HTTP Status Codes
Status Code | Description |
---|---|
200 |
Success |
400 |
Bad Request - Invalid input data |
404 |
Not Found - Endpoint not found |
500 |
Internal Server Error |
Error Response Format
{
"error": "Error message description"
}
Common Error Messages
"No JSON data provided"
- POST request missing JSON body"Missing required fields. Provide 'type', 'year', 'month', and 'day'."
- Missing required parameters"Invalid date type. Use 'BS_to_AD' or 'AD_to_BS'."
- Invalid conversion type"Invalid date values: [error details]"
- Invalid date format or values"Date conversion failed"
- Internal conversion error
Support & Contact
If you have any questions, issues, or suggestions regarding the API, please feel free to reach out:
- GitHub: @SudhanParajuli
- LinkedIn: Sudhan Parajuli
- Twitter: @sudhanparajuli0