Skip to content

nabinkhadka/Android-Java-Nepali-English-Date-Conversion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nepali-english-date-conversion-for-java-android

Trying to build a reusable simple java class for nepali to english date conversion and vice-versa NOT READY YET

##English to Nepali Conversion

        Converter converter = new Converter();
        NepaliDate nepaliDate = converter.getNepaliDate(1992, 4, 20);
        
        System.out.println("Equivalent Nepali date is " + nepaliDate.toString());
        System.out.println("Nepali year is " + nepaliDate.getSaal());
        System.out.println("Nepali month is " + nepaliDate.getMahinaInWords());
        System.out.println("Nepali date is " + nepaliDate.getGatey());

Output:

Equivalent Nepali date is 2049 / 1 / 8 Monday
Nepali year is 2049
Nepali month is Baisakh
Nepali date is 8

##Nepali to English Conversion

        Converter converter = new Converter();
        EnglishDate englishDate = converter.getEnglishDate(2049, 1, 8);

        System.out.println("Equivalent English date is " + englishDate.toString());
        System.out.println("English year is " + englishDate.getYear());
        System.out.println("English month is " + englishDate.getMonthAsText());
        System.out.println("English date is " + englishDate.getDate());

Output:

Equivalent English date is 1992 / 4 / 20 Monday
English year is 1992
English month is April
English date is 20

##A complete Nepali month List of all days in a month can be obtained (which can be useful to render as a calendar)

        Converter converter = new Converter();

        List<NepaliDate> nepaliDateList = converter.getFullNepaliMonthOf(1992, 4, 20);
        //nepaliDateList list contains all days of the April month of 1992.
        for (NepaliDate nepaliDate: nepaliDateList){
            System.out.println(nepaliDate.toString());
        }

Thank you!

About

Java project for nepali to english date conversion and vice-versa

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages