step 1.Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2.Add the dependency
dependencies {
implementation 'com.github.MohammadSadeghMehrafzoon:ConvertDateAndTimeToPersian:0.0.1'
}
=> kotlin
val timeAndDate = PersianTimeAndDate(dateAndTime) // for a time and date string
val date = PersianDate(date) //Just for the date
val time = PersianTime(time) //Just for the time
=> java
PersianDate date = new PersianDate(date); //Just for the date
PersianTime time = new PersianTime(time); //Just for the time
PersianTimeAndDate timeAndDate = new PersianTimeAndDate(dateAndTime); // for a time and date string
date.getPersianDate()
time.getPersianTime()
timeAndDate.getPersianDate()
timeAndDate.getPersianTime()
val timeAndDate = PersianTimeAndDate("2023-01-28T13:15:00")
timeAndDate.getPersianDate() // 1401/11/8
timeAndDate.getPersianTime() // 18:45
Or
val timeAndDate = PersianTimeAndDate("2023/01/28T13:15:00")
timeAndDate.getPersianDate() // 1401/11/8
timeAndDate.getPersianTime() // 18:45
val date = PersianDate("2023-01-28")
date.getPersianDate() // 1401/11/8
Or
val date = PersianDate("2023/01/28")
date.getPersianDate() // 1401/11/8