### Format PersianDate with Custom Patterns Source: https://github.com/samanzamani/persiandate/blob/master/README.md Provides examples of formatting a `PersianDate` object using different custom patterns. It demonstrates how to display dates in 'Year/Month/Day' format and a more descriptive 'Year Month Day' format with Farsi characters. ```java PersianDate pdate = new PersianDate(); PersianDateFormat pdformater1 = new PersianDateFormat('Y/m/d'); pdformater1.format(pdate);//1396/05/20 PersianDateFormat pdformater2 = new PersianDateFormat('y F j'); pdformater2.format(pdate);//۱۹ تیر ۹۶ ``` -------------------------------- ### PersianDate Class API Reference Source: https://github.com/samanzamani/persiandate/blob/master/README.md Comprehensive API documentation for the `PersianDate` class, detailing its constructors and methods for setting, getting, converting, and manipulating Jalali and Gregorian dates, as well as time components. ```APIDOC PersianDate Class: Constructors: PersianDate(Long timestamp): make time with timestamp PersianDate(DATE date): Constructor for make PersianDate object from Date object Methods: setShYear(int year): Set Jalali year setShMonth(int month): Set Jalali month setShDay(int day): Set Jalali day setGrgYear(int year): Set Gregorian year setGrgMonth(int month): Set Gregorian month setGrgDay(int day): Set Gregorian day setHour(int hour): Set hour of day setMinute(int minute): Set minute of day setSecond(int second): Set second of day getShYear(): (int) return Jalali year getShMonth(): (int) return Jalali month getShDay(): (int) return Jalali day getGrgYear(): (int) return Gregorian year getGrgMonth(): (int) return Gregorian month getGrgDay(): (int) return Gregorian day getHour(): (int) return hour of day getMinute(): (int) return minute of day getSecond(): (int) return second of day getTime(): (Long) return timestamp initGrgDate(): init date from Gregorian initJalaliDate(): init date from Jalali isLeap(): Check Jalali year is leap (TRUE-FALSE) grgIsLeap(): Check Gregorian year is leap (TRUE-FALSE) toJalali(int year, int month, int day): Convert Gregorian to Jalali (return int[3]) toGregorian(int year, int month, int day): Convert Jalali to Gregorian (return int[3]) dayOfWeek(): 0-6 (0=sat) getDayInYear(): 1-366 dayName(): شنبه-جمعه monthName(): فروردین-اسفند getMonthDays(): return month lenght addDate(): add some date to object after(PersianDate dateInput): Compare 2 date (true=if input date after this) before(PersianDate dateInput): Compare 2 date (true=if input date before this) equals(PersianDate dateInput): Compare 2 date (true=if input date equals this) untilToday(): Cal year,month,day until now getDayuntilToday(): Cal day until now toDate(): convert to Date object ``` -------------------------------- ### Configure Jitpack Maven Repository in Gradle Source: https://github.com/samanzamani/persiandate/blob/master/README.md This snippet demonstrates how to add the Jitpack Maven repository to your project's root `build.gradle` file. This step is necessary to resolve dependencies hosted on Jitpack, such as the PersianDate library. ```groovy allprojects { repositories { ... maven { url 'https://jitpack.io' } } } ``` -------------------------------- ### PersianDateFormat Class API Reference Source: https://github.com/samanzamani/persiandate/blob/master/README.md API documentation for the `PersianDateFormat` class, detailing methods for formatting and parsing dates, along with a comprehensive list of pattern keys for both parsing and formatting. ```APIDOC PersianDateFormat Class: Methods: format(): (String) Display date parse(String date, String pattern): (PersianDate) Convert string Jalali date (e.g., 1396-05-05 & 'yyyy-MM-dd') to Persiandate parseGrg(String date, String pattern): (PersianDate) Convert string Gregorian date (e.g., 1396-05-05 & 'yyyy-MM-dd') to Persiandate Item for parse date: yyyy: Year (1396-2012-...) MM: Month number (12-01-02-...) dd: Day number (21-01-02-...) HH: Hour (21-01-02-...) mm: Minute (21-01-02-...) ss: Second (21-01-02-...) Pattern item for format date: l: Day name in week (شنبه و ....) j: Day number in month(1-10-20...) F: Month name (فروردین) Y: Year (1396...) H: Hour in day i: Minutes in hour s: Second in minute d: day in month (01-02-21...) g: Hour in day 1-12 n: Month of year 1-12 m: Month of year 01-12 t: number day of month w: day in week 0-6 y: year with 2 digits z: Number of days (full) past the year L: Is leap year (0-1) ``` -------------------------------- ### Instantiate PersianDate Object in Java Source: https://github.com/samanzamani/persiandate/blob/master/README.md This Java snippet illustrates the basic way to create a new instance of the PersianDate class. This object serves as the entry point for performing various operations with Persian (Jalali) dates. ```java PersianDate pdate = new PersianDate(); ``` -------------------------------- ### Format PersianDate Object Source: https://github.com/samanzamani/persiandate/blob/master/README.md Demonstrates how to format a `PersianDate` object using a default `PersianDateFormat` instance. This snippet shows a basic usage of the formatter. ```java PersianDateFormat pdformater = new PersianDateFormat(); pdformater.format(pdate); ``` -------------------------------- ### Add PersianDate Library Dependency to Gradle Source: https://github.com/samanzamani/persiandate/blob/master/README.md This snippet shows how to declare the PersianDate library as a dependency in your module's `build.gradle` file. Once added, the library's functionalities will be available in your Android project. ```groovy dependencies { implementation 'com.github.samanzamani:PersianDate:1.7.1' } ``` -------------------------------- ### Use Farsi Characters in PersianDateFormat Source: https://github.com/samanzamani/persiandate/blob/master/README.md Illustrates how to configure `PersianDateFormat` to output date numbers using Farsi characters by specifying `PersianDateNumberCharacter.FARSI`. This is useful for displaying dates in a culturally appropriate format. ```java PersianDate pDate = new PersianDate(); PersianDateFormat pdformater1 = new PersianDateFormat(); PersianDateFormat pdformater2 = new PersianDateFormat('y F j'); PersianDateFormat pdformater3 = new PersianDateFormat('y F j',PersianDateNumberCharacter.FARSI); //return Farsi character ``` ```java PersianDate pDate = new PersianDate(); PersianDateFormat.format(pDate,'y F j'); PersianDateFormat.format(pDate,'y F j',PersianDateNumberCharacter.FARSI); //return Farsi character ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.