All Projects → samanzamani → Persiandate

samanzamani / Persiandate

Persian date for android

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Persiandate

Datedelta
Date arithmetic in Python
Stars: ✭ 135 (-34.15%)
Mutual labels:  date
Server Date
Make the server's clock available in the browser.
Stars: ✭ 157 (-23.41%)
Mutual labels:  date
Date
A date and time library based on the C++11/14/17 <chrono> header
Stars: ✭ 2,389 (+1065.37%)
Mutual labels:  date
React Calendar
Ultimate calendar for your React app.
Stars: ✭ 2,082 (+915.61%)
Mutual labels:  date
Gostradamus
Gostradamus: Better DateTimes for Go 🕰️
Stars: ✭ 148 (-27.8%)
Mutual labels:  date
Time
Building a better date/time library for Swift
Stars: ✭ 1,983 (+867.32%)
Mutual labels:  date
Moment Range
Fancy date ranges for Moment.js
Stars: ✭ 1,639 (+699.51%)
Mutual labels:  date
Vuetify Daterange Picker
The missing date range picker for Vuetify JS you have been looking for.
Stars: ✭ 192 (-6.34%)
Mutual labels:  date
Dart Basic Utils
A dart package for many helper methods fitting common situations
Stars: ✭ 153 (-25.37%)
Mutual labels:  date
Brpickerview
BRPickerView 封装的是iOS中常用的选择器组件,主要包括:日期选择器(支持年月日、年月等15种日期样式选择,支持设置星期、至今等)、地址选择器(支持省市区、省市、省三种地区选择)、自定义字符串选择器(支持单列、多列、二级联动、三级联动选择)。支持自定义主题样式,适配深色模式,支持将选择器组件添加到指定容器视图。
Stars: ✭ 2,149 (+948.29%)
Mutual labels:  date
Tail.datetime
A lightweight, translat- and configurable Open Source DateTime Picker, written in pure vanilla JavaScript!
Stars: ✭ 139 (-32.2%)
Mutual labels:  date
Date Picker
📅 Custom responsive date picker widget for Android, written in Kotlin.
Stars: ✭ 146 (-28.78%)
Mutual labels:  date
Xk Time
xk-time 是时间转换,时间计算,时间格式化,时间解析,日历,时间cron表达式和时间NLP等的工具,使用Java8,线程安全,简单易用,多达70几种常用日期格式化模板,支持Java8时间类和Date,轻量级,无第三方依赖。
Stars: ✭ 162 (-20.98%)
Mutual labels:  date
Anytime
Anything to POSIXct or Date Converter
Stars: ✭ 137 (-33.17%)
Mutual labels:  date
Dpicker
A framework-agnostic minimal date picker
Stars: ✭ 187 (-8.78%)
Mutual labels:  date
Ngx Date Fns
⏳ date-fns pipes for Angular 2.0 and above ⏳
Stars: ✭ 135 (-34.15%)
Mutual labels:  date
Fecha
Lightweight and simple JS date formatting and parsing
Stars: ✭ 1,955 (+853.66%)
Mutual labels:  date
Lightpick
(deprecated) Check out the new date picker Litepicker
Stars: ✭ 204 (-0.49%)
Mutual labels:  date
React Native Modal Datetime Picker
A React-Native datetime-picker for Android and iOS
Stars: ✭ 2,412 (+1076.59%)
Mutual labels:  date
Things Calendar
Simple but elegant datepicker for the web — inspired by Things for mac
Stars: ✭ 165 (-19.51%)
Mutual labels:  date

Persian Date(Jalali)

forthebadge forthebadge
platform Download Android Arsenal Method and size

Update

I'm going to release v0.9 as soon as possible with some bug fixing, so please send any problem or feature request.

About

This is simple android calender converter for Convert Jalali date to Gregorian date.

Gradle

dependencies {
    implementation 'com.github.samanzamani.persiandate:PersianDate:0.8'
}

what's new

version 0.8

  • Fix date formatting in year 1989 #29
  • add three new method to get month name in Afghan,Kurdish and Pashto name and from version 0.8 you can use X,C and E to display month name in Afghan,Kurdish and Pashto in PersianDateFormat #28

version 0.7

  • Fix addDate - addYear - addMonth methods #20
  • add new method for calculate month length => getMonthLength

Let's convert some date :)

Step 1

PersianDate pdate = new PersianDate();

step2

PersianDateFormat pdformater = new PersianDateFormat();
pdformater.format(pdate);

More example

PersianDate

  • PersianDate class methods
method description
PersianDate(Long timestamp) make time with timestamp
PersianDate(DATE date) Constractor for make PersianDate object from Date object
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

PersianDateFormat

  • PersianDate class methods for display and parse date
method description
format() (String) Display date
parse(String date,String pattern) (PersianDate) Convert string Jalali date (1396-05-05 & 'YYYY-MM-dd') to Persiandate
parseGrg(String date,String pattern) (PersianDate) Convert string Gregorian date (1396-05-05 & 'YYYY-MM-dd') to Persiandate
format() (String) Display date
  • Item for parse date
String key Role
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
Pattern key Role
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)

Example

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);//۱۹ تیر ۹۶
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].