Skip to content

Public API to fetch current Bikram Sambat date & Nepal time in custom formats🇳🇵

Notifications You must be signed in to change notification settings

amitgaru2/nepali-datetime-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nepali Datetime Public API

Public APIs to access Nepali Datetime (Bikram Sambat Date & Nepal Time) with custom formatting options. The project is based on the library nepali_datetime.

The APIs documentation URL is https://nepali-datetime.amitgaru.me/docs.

Basic Usage

  1. To get today's Bikram Sambat Date

    curl -X GET https://nepali-datetime.amitgaru.me/date
    # returns { "data": "2077-06-26" }

    Response format can be changed by

    curl -X GET "https://nepali-datetime.amitgaru.me/date?format=%d-%B-%y"
    # returns { "data": "26-Aswin-77" }

    More about the formatting in the table described here.

  2. Similarly, to get today's Bikram Sambat Date & current Nepal Time

    curl -X GET https://nepali-datetime.amitgaru.me/datetime
    # returns { "data": "2077-06-26 01:04:46.769648" }
  3. Convert Bikram Sambat (BS) date to AD date

    curl -X GET 'https://nepali-datetime.amitgaru.me/date/convert/bs-ad?bs_date=2080-10-29&format=%Y-%m-%d'
    # returns { "data": "2024-02-12" }
  4. Convert AD date to Bikram Sambat (BS) date

    curl -X GET 'https://nepali-datetime.amitgaru.me/date/convert/ad-bs?ad_date=2024-02-12&format=%Y-%m-%d'
    # returns { "data": "2080-10-29" }

Formatting in 2., 3., 4. can be applied with the same approach as described in 1.

Use cases

  1. Web pages and applications
  2. Mobile applications
  3. Desktop applications
  4. Terminals / Consoles (zsh, tmux)